PHP code example of bigpaulie / yii2-social-share

1. Go to this page and download the library: Download bigpaulie/yii2-social-share 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/ */

    

bigpaulie / yii2-social-share example snippets

 
    use bigpaulie\social\share\Share;

    echo Share::widget();

    echo Share::widget([
        'type' => 'small',
        'tag' => 'div',
        'template' => '<div>{button}</div>',
    ]);

    echo Share::widget([
        'url' => 'http://www.domain.com',
    ]);

    echo Share::widget([
        'url' => Url::to(['site/index'] , TRUE),
    ]);

    use yii\helpers\Url;

    echo Share::widget([
        'title' => 'Some title',
        'description' => 'Some description',
        'image' => '/path-to-some-image.jpg',
    ]);

    echo Share::widget([
        'htmlOptions' => [
            'id' => 'new-id',
            'class' => 'my-class',
        ],
    ]);
 
    echo Share::widget([
        'type' => Share::TYPE_EXTRA_SMALL
 
    echo Share::widget([
        'type' => Share::TYPE_SMALL
    ]);
 
    echo Share::widget([
        'type' => Share::TYPE_LARGE
    ]);

    echo Share::widget([
        'text' => 'Click to share on {network}',
    ]);

    echo Share::widget([
        '

    echo Share::widget([
        'exclude' => ['network1', 'network2']
    ]);

    // add by default
    echo Share::widget([
        'addUtm' => true,
    ]);
    
    // little customization
    echo Share::widget([
        'addUtm' => true, // necessary flag
        'utmMedium' => 'social_share',
        'utmCampaign' => 'viral_retention',
     ]);