PHPackages                             tmukherjee13/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. tmukherjee13/yii2-socialshare

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

tmukherjee13/yii2-socialshare
=============================

Social share widget for the Yii2 Framework

2.0.0(6y ago)024MITPHP

Since Sep 1Pushed 6y agoCompare

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

READMEChangelog (1)Dependencies (1)Versions (18)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 tmukherjee13/yii2-socialshare

```

or add

```
"tmukherjee13/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);
}
```

UPDATE
------

[](#update)

This fork fixes the conflict of using Object in classes since in PHP 7.2 Object is a reserved keyword.

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

[](#other-extensions)

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

###  Health Score

30

—

LowBetter than 62% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity72

Established project with proven stability

 Bus Factor1

Top contributor holds 80% 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 ~70 days

Recently: every ~263 days

Total

17

Last Release

2470d ago

Major Versions

0.0.6 → 1.0.02016-10-10

1.8.1 → 2.0.02019-09-26

### Community

Maintainers

![](https://www.gravatar.com/avatar/a1c0309df8d5e35e8a27ebff97e637fb981fe299c3790e44fa6863c903e5775c?d=identicon)[tmukherjee13](/maintainers/tmukherjee13)

---

Top Contributors

[![greeflas](https://avatars.githubusercontent.com/u/17636915?v=4)](https://github.com/greeflas "greeflas (32 commits)")[![tmukherjee13](https://avatars.githubusercontent.com/u/6323758?v=4)](https://github.com/tmukherjee13 "tmukherjee13 (6 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/tmukherjee13-yii2-socialshare/health.svg)

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

###  Alternatives

[yiimaker/yii2-social-share

Extension for sharing on social networks

48112.8k4](/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.

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

Yii2 widget to register JS into view

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

PHPackages © 2026

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