PHPackages                             black-lamp/yii2-socialshare - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. black-lamp/yii2-socialshare

ActiveYii2-extension[Utility &amp; Helpers](/categories/utility)

black-lamp/yii2-socialshare
===========================

Social share widget for the Yii2 Framework

1.8.1(9y ago)37851GNU Public LicensePHP

Since Sep 1Pushed 9y ago7 watchersCompare

[ Source](https://github.com/black-lamp/yii2-socialshare)[ Packagist](https://packagist.org/packages/black-lamp/yii2-socialshare)[ RSS](/packages/black-lamp-yii2-socialshare/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (10)Dependencies (1)Versions (17)Used By (0)

Social share widget for Yii2
============================

[](#social-share-widget-for-yii2)

This widget adds share links for social networks.

[![Latest Stable Version](https://camo.githubusercontent.com/896cf356541dcbad7b6ca98a7fb1d18d1bbd82f30fd266cd97bdaac5519a6b92/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d736f6369616c73686172652f762f737461626c65)](https://packagist.org/packages/black-lamp/yii2-socialshare)[![Latest Unstable Version](https://camo.githubusercontent.com/93b256b0f464ca520d58de214eb2558e885af775711421f942e0fbf857a123e2/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d736f6369616c73686172652f762f756e737461626c65)](https://packagist.org/packages/black-lamp/yii2-socialshare)[![License](https://camo.githubusercontent.com/263cd3b0f96548ecd5c7aa018416a94563f1ec4bd7e388e6c8f8cf6505296244/68747470733a2f2f706f7365722e707567782e6f72672f626c61636b2d6c616d702f796969322d736f6369616c73686172652f6c6963656e7365)](https://packagist.org/packages/black-lamp/yii2-socialshare)

It supports from the box

- VK
- Facebook
- Twitter
- Google+
- LinkedIn
- Pinterest
- Telegram
- Viber
- WhatsApp
- Gmail

Installation
------------

[](#installation)

#### Run command

[](#run-command)

```
composer require black-lamp/yii2-socialshare

```

or add

```
"black-lamp/yii2-socialshare": "1.*.*"
```

to the require section of your composer.json.

#### Add 'SocialShare' component to application config

[](#add-socialshare-component-to-application-config)

```
'components' => [
    // ...
    'socialShare' => [
        'class' => bl\socialShare\SocialShare::className(),
        'defaultIcons' => true,
        'attributes' => [
            'class' => 'social-btn'
        ],
        'networks' => [
            'facebook' => [
                'class' => bl\socialShare\classes\Facebook::className(),
                'label' => 'Facebook'
            ],
            'twitter' => [
                'class' => bl\socialShare\classes\Twitter::className(),
                'label' => 'Twitter',
                // custom option for Twitter class
                'account' => 'twitterAccount'
            ],
            'googlePlus' => [
                'class' => bl\socialShare\classes\GooglePlus::className(),
                'label' => 'Google+'
            ],
            'vk' => [
                'class' => bl\socialShare\classes\Vkontakte::className(),
                'label' => 'vk'
            ],
            // other social networks ...
        ]
    ],
]
```

In this component you need to add and configure social network classes

#### Component configuration properties

[](#component-configuration-properties)

OptionDescriptionTypeDefaultnetworksArray of social networks classes configurationarray-attributesHTML attributes for all share linksarray-defaultIconsUse default font-icons instead text labels or notbooleanfalseenableSeoEnable or disable appending SEO attributes from `seoAttributes` array for linksbooleantrueseoAttributesArray of SEO attributes for linksarray\['target' =&gt; '\_blank', 'rel' =&gt; 'nofollow'\]#### Social network class configuration properties

[](#social-network-class-configuration-properties)

OptionDescriptionTypeclassNamespace of social network classstringlabelText for linkstringattributesHTML attributes for share linkarrayUsing
-----

[](#using)

You should use the widget for adding the share links on page

```

```

#### Widget configuration properties

[](#widget-configuration-properties)

OptionDescriptionTypecomponentIdid of SocialShare component from configstringurlAbsolute URL to the pagestringtitlePage titlestringdescriptionPage descriptionstringimageAbsolute URL to the image for pagestringexceptionsExceptions for social networks. In this array you can override default title, description, link or image.arrayWhat if i want to add a new social network?
-------------------------------------------

[](#what-if-i-want-to-add-a-new-social-network)

You must create class and extend it from [bl\\socialShare\\base\\SocialNetwork](https://github.com/black-lamp/yii2-socialshare/blob/master/base/SocialNetwork.php) abstract class

```
use bl\socialShare\base\SocialNetwork;

class LinkedIn extends SocialNetwork
{

}
```

and implement the method [getLink()](https://github.com/black-lamp/yii2-socialshare/blob/master/base/SocialNetwork.php#L84)

```
class LinkedIn extends bl\socialShare\base\SocialNetwork
{
    /**
     * @inheritdoc
     */
    public function getLink($url, $title, $description, $image, $component)
    {
    }
}
```

this method must initialize route to the social network and return `initLink()` method with `$component` argument

```
/**
 * @inheritdoc
 */
public function getLink($url, $title, $description, $image, $component)
{
    $this->_route = "https://www.linkedin.com/shareArticle?mini=true"
                    ."&url=$url"
                    ."&title=$title"
                    ."&summary=$description";

    return $this->initLink($component);
}
```

Other extensions
----------------

[](#other-extensions)

[yii2-social-networks](https://github.com/black-lamp/yii2-social-networks) - this widget adds links to social networks

###  Health Score

34

—

LowBetter than 77% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 94.1% of commits — single point of failure

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 ~12 days

Recently: every ~30 days

Total

16

Last Release

3360d ago

Major Versions

0.0.6 → 1.0.02016-10-10

### Community

Maintainers

![](https://www.gravatar.com/avatar/0e1784ec992318bf7ed40a2025a0ca035a01143de89054f0f4c9bc39469928c1?d=identicon)[GutsVadim](/maintainers/GutsVadim)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (32 commits)")[![GutsVadim](https://avatars.githubusercontent.com/u/9513738?v=4)](https://github.com/GutsVadim "GutsVadim (1 commits)")[![nojes](https://avatars.githubusercontent.com/u/17221145?v=4)](https://github.com/nojes "nojes (1 commits)")

---

Tags

yii2socialwidgetsharenetworks

### Embed Badge

![Health badge](/badges/black-lamp-yii2-socialshare/health.svg)

```
[![Health](https://phpackages.com/badges/black-lamp-yii2-socialshare/health.svg)](https://phpackages.com/packages/black-lamp-yii2-socialshare)
```

###  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)[softark/yii2-dual-listbox

Bootstrap Dual Listbox Widget for Yii 2

20144.4k11](/packages/softark-yii2-dual-listbox)[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)
