Download the PHP package black-lamp/yii2-socialshare without Composer
On this page you can find all versions of the php package black-lamp/yii2-socialshare. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package yii2-socialshare
Social share widget for Yii2
This widget adds share links for social networks.
It supports from the box
- VK
- Google+
- Telegram
- Viber
- Gmail
Installation
Run command
or add
to the require section of your composer.json.
Add 'SocialShare' component to application config
In this component you need to add and configure social network classes
Component configuration properties
Option | Description | Type | Default |
---|---|---|---|
networks | Array of social networks classes configuration | array | - |
attributes | HTML attributes for all share links | array | - |
defaultIcons | Use default font-icons instead text labels or not | boolean | false |
enableSeo | Enable or disable appending SEO attributes from seoAttributes array for links |
boolean | true |
seoAttributes | Array of SEO attributes for links | array | ['target' => '_blank', 'rel' => 'nofollow'] |
Social network class configuration properties
Option | Description | Type |
---|---|---|
class | Namespace of social network class | string |
label | Text for link | string |
attributes | HTML attributes for share link | array |
Using
You should use the widget for adding the share links on page
Widget configuration properties
Option | Description | Type |
---|---|---|
componentId | id of SocialShare component from config | string |
url | Absolute URL to the page | string |
title | Page title | string |
description | Page description | string |
image | Absolute URL to the image for page | string |
exceptions | Exceptions for social networks. In this array you can override default title, description, link or image. | array |
What if i want to add a new social network?
You must create class and extend it from bl\socialShare\base\SocialNetwork abstract class
and implement the method getLink()
this method must initialize route to the social network
and return initLink()
method with $component
argument
Other extensions
yii2-social-networks - this widget adds links to social networks