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

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

alkurn/yii2-socialshare
=======================

Yii2 Social Link Sharer Extension

0607PHP

Since Oct 15Pushed 7y ago1 watchersCompare

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

READMEChangelogDependenciesVersions (1)Used By (0)

yii2-socialshare
================

[](#yii2-socialshare)

[![Latest Stable Version](https://camo.githubusercontent.com/b4fbce500e84ea3cf508d559622fcff0bcdf8f8958cc1cdf4e7cf8ce52dfe697/68747470733a2f2f706f7365722e707567782e6f72672f616c6b75726e2f796969322d736f6369616c73686172652f762f737461626c65)](https://packagist.org/packages/alkurn/yii2-socialshare) [![Total Downloads](https://camo.githubusercontent.com/c6d37b794e0eb4e78f7f6ecc8a3be8887630325bb5020fe6db659fe0a64e990d/68747470733a2f2f706f7365722e707567782e6f72672f616c6b75726e2f796969322d736f6369616c73686172652f646f776e6c6f616473)](https://packagist.org/packages/alkurn/yii2-socialshare) [![Latest Unstable Version](https://camo.githubusercontent.com/9cc600d0b025073692a49e7375a336a578d0100f7690b473e4a7cff03a33ade4/68747470733a2f2f706f7365722e707567782e6f72672f616c6b75726e2f796969322d736f6369616c73686172652f762f756e737461626c65)](https://packagist.org/packages/alkurn/yii2-socialshare) [![License](https://camo.githubusercontent.com/80522509a7d489ad397eef2939296ed49c73a52001db9a6974846c6a93fe32bd/68747470733a2f2f706f7365722e707567782e6f72672f616c6b75726e2f796969322d736f6369616c73686172652f6c6963656e7365)](https://packagist.org/packages/alkurn/yii2-socialshare)

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 alkurn/yii2-socialshare "dev-master"

```

OR add to composer.json

```
    "alkurn/yii2-socialshare": "dev-master"

```

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

[](#example-usage-)

```
    use alkurn\socialshare\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 to types of buttons small (icon only) large (icon + text)

```
    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']
    ]);
```

### Contributions

[](#contributions)

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

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/485ae3b1c7496e2d8d100c7c12274e3e7d490afc132ef1b3a2b2a30f10727e1e?d=identicon)[gmankar](/maintainers/gmankar)

### Embed Badge

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

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

PHPackages © 2026

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