PHPackages                             andre1ka/yii2-social-share - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. andre1ka/yii2-social-share

ActiveLibrary

andre1ka/yii2-social-share
==========================

Yii2 Social Link Sharer Extension

v1.2(8y ago)08MITPHPPHP &gt;= 5.4

Since Sep 5Pushed 5y agoCompare

[ Source](https://github.com/andre1ka-ber/yii2-social-share)[ Packagist](https://packagist.org/packages/andre1ka/yii2-social-share)[ RSS](/packages/andre1ka-yii2-social-share/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

yii2-social-share
=================

[](#yii2-social-share)

[![Latest Stable Version](https://camo.githubusercontent.com/f9e404385c7478e4574eebb58022dfe43675e9abf6f96cf76d9fbe46ce2a19c0/68747470733a2f2f706f7365722e707567782e6f72672f6269677061756c69652f796969322d736f6369616c2d73686172652f762f737461626c65)](https://packagist.org/packages/bigpaulie/yii2-social-share) [![Total Downloads](https://camo.githubusercontent.com/c46a807f7986e32f5b09e82587f11484d188fdc9503071d01f2b5faa7e5aef6b/68747470733a2f2f706f7365722e707567782e6f72672f6269677061756c69652f796969322d736f6369616c2d73686172652f646f776e6c6f616473)](https://packagist.org/packages/bigpaulie/yii2-social-share) [![Latest Unstable Version](https://camo.githubusercontent.com/2c212438f10d54592f8218a633160cc1c150424ee973cd6af2814445e19605eb/68747470733a2f2f706f7365722e707567782e6f72672f6269677061756c69652f796969322d736f6369616c2d73686172652f762f756e737461626c65)](https://packagist.org/packages/bigpaulie/yii2-social-share) [![License](https://camo.githubusercontent.com/e5f54fd003257bbd52ca699caeecc54f76d2da0c952def6a41db3d99bb10c678/68747470733a2f2f706f7365722e707567782e6f72672f6269677061756c69652f796969322d736f6369616c2d73686172652f6c6963656e7365)](https://packagist.org/packages/bigpaulie/yii2-social-share)

Yii2 Social Link Sharer

Built using [Bootstrap Social](http://lipis.github.io/bootstrap-social/) and [Font Awesome](http://fontawesome.io/) , two very cool projects ! Please keep in mind that this is a work in progress.

Install
-------

[](#install)

The preferred way of installing is through composer

```
    composer require --prefer-dist andre1ka/yii2-social-share "dev-master"

```

OR add to composer.json

```
    "andre1ka/yii2-social-share": "dev-master"

```

Example usage :
---------------

[](#example-usage-)

```
    use andre1ka\social\share\Share;
```

By default you can run the widget with no configuration parameters

```
    echo Share::widget();
```

this will produce an unordered list "ul" tag like

```

        ....
        ....
        ....

```

#### Changing the layout of the widget

[](#changing-the-layout-of-the-widget)

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

The output of this will be something similar to :

```

         ....
         ....
         ....

```

#### The shared URL

[](#the-shared-url)

By default the widget set's the URL to the current route, you can change that as needed by using the "url" property.

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

Or

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

Don't forget to require the helper library Url and to use the second parameter of the method for the full URL to the page.

```
    use yii\helpers\Url;
```

#### The shared data

[](#the-shared-data)

By default the widget pass to social network only URL. Some networks, for example Pinterest, allow pass title, description and image. You can change that as needed by using the "title", "description" or "image" properties.

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

#### Attributes of main container

[](#attributes-of-main-container)

You can add or change attributes of the main container using the htmlOptions property. By default the main container has an id attribute similar to #w0, you can change that if you want.

```
    echo Share::widget([
        'htmlOptions' => [
            'id' => 'new-id',
            'class' => 'my-class',
        ],
    ]);
```

#### Widget button types

[](#widget-button-types)

The widget provides three types of buttons extra-small (small icons only) small (icon only) large (icon + text)

```
    echo Share::widget([
        'type' => Share::TYPE_EXTRA_SMALL
```

```
    echo Share::widget([
        'type' => Share::TYPE_SMALL
    ]);
```

```
    echo Share::widget([
        'type' => Share::TYPE_LARGE
    ]);
```

The default text for the large buttons is "Share on NETWORK", where NETWORK is the name of the social network ex : Facebook. You can change the default text by using the "text" property of the widget.

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

#### Networks

[](#networks)

Currently the widget provides 6 buttons Facebook Google Plus Twitter Pinterest Linkedin Vk odnoklassniki

#### Including only some networks

[](#including-only-some-networks)

For some reason you may need to include only some networks. In order to do that you can use the "include" property of the widget

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

Presented social networks will be shown in that order in which you put them.

#### Excluding some networks

[](#excluding-some-networks)

For some reason you may need to exclude one or more networks. In order to do that you can use the "exclude" property of the widget

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

#### Add utm marks

[](#add-utm-marks)

For enterprise apps you mostly need to add UTM mark for analytics.

```
    // add by default
    echo Share::widget([
        'addUtm' => true,
    ]);

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

```

### Contributions

[](#contributions)

Contributions are most welcomed, just fork modify and submit a pull request.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~143 days

Total

5

Last Release

2964d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/bc21a519a22a2fa63a5678ba3a825b0bcac36123ca55265be7989face5309131?d=identicon)[andre1ka-ber](/maintainers/andre1ka-ber)

---

Top Contributors

[![andre1ka-ber](https://avatars.githubusercontent.com/u/61691555?v=4)](https://github.com/andre1ka-ber "andre1ka-ber (14 commits)")[![bigpaulie](https://avatars.githubusercontent.com/u/5903753?v=4)](https://github.com/bigpaulie "bigpaulie (10 commits)")[![schatzopoulos](https://avatars.githubusercontent.com/u/20520798?v=4)](https://github.com/schatzopoulos "schatzopoulos (4 commits)")[![AsterAI](https://avatars.githubusercontent.com/u/3739985?v=4)](https://github.com/AsterAI "AsterAI (3 commits)")[![DarkDrim](https://avatars.githubusercontent.com/u/3989836?v=4)](https://github.com/DarkDrim "DarkDrim (2 commits)")[![Phrlog](https://avatars.githubusercontent.com/u/9060150?v=4)](https://github.com/Phrlog "Phrlog (1 commits)")

---

Tags

yii2socialwidgetshare

### Embed Badge

![Health badge](/badges/andre1ka-yii2-social-share/health.svg)

```
[![Health](https://phpackages.com/badges/andre1ka-yii2-social-share/health.svg)](https://phpackages.com/packages/andre1ka-yii2-social-share)
```

###  Alternatives

[yiimaker/yii2-social-share

Extension for sharing on social networks

48111.3k4](/packages/yiimaker-yii2-social-share)[kartik-v/yii2-social

Module containing useful widgets for Yii Framework 2.0 that integrates social functionalities from DISQUS, Facebook, Google etc.

91256.5k8](/packages/kartik-v-yii2-social)[richardfan1126/yii2-js-register

Yii2 widget to register JS into view

1357.2k7](/packages/richardfan1126-yii2-js-register)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
