1. Go to this page and download the library: Download minetro/social library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
minetro / social example snippets
use Contributte\Social\Facebook\LikeButton;
use Contributte\Social\Facebook\Script;
protected function createComponentLikeButton()
{
$button = new LikeButton();
$attrs = $button->getAttributes();
// URL - manually
$attrs->add('data-url', $this->link('Home:default'));
// URL - current
$attrs->add('data-url', $this->link('//this'));
// Add other attributes
$attrs->add('data-layout', $button::LAYOUT_BUTTON_COUNT);
// OR
$attrs->data('layout', $button::LAYOUT_BUTTON_COUNT);
return $button;
}
protected function createComponentScript()
{
$script = new Script();
$script->setApiVersion("v2.6");
$script->setAppId(123456);
return $script;
}
use Contributte\Social\Google\PlusOne;
protected function createComponentPlusone() {
$button = new PlusOne();
$button->setMode($button::MODE_DEFAULT);
$button->setUrl('www.google.com');
return $button;
}
/** @var Contributte\Social\Google\IPlusOneFactory @inject */
public $plusOneFactory;
protected function createComponentPlusone() {
$button = $this->plusOneFactory->create();
$button->setMode($button::MODE_DEFAULT);
$button->setUrl('www.google.com');
return $button;
}