yaro/soc-share is a Laravel package for social network share link builder.
It currently has 10 GitHub stars and 2.016 downloads on Packagist (latest version 1.0.4).
Install it with composer require yaro/soc-share.
Discover more Laravel packages by yaro
or browse all Laravel packages to compare alternatives.
Last updated
Link builder for social share button for Laravel 5.
Add dependency to composer.json:
"require": {
"yaro/soc-share": "1.*"
}
Add to config/app.php:
'providers' => array(
//...
Yaro\SocShare\ServiceProvider::class,
//...
),
'aliases' => array(
//...
'SocShare' => Yaro\SocShare\Facade::class,
//...
),
Then run command:
$ php artisan vendor:publish --provider="Yaro\SocShare\ServiceProvider"
Currently supported networks: google+, facebook, twitter, vkontakte, pinterest, tumblr, odnoklassniki, linkedin.
Ex:
<a href="{{ SocShare::gplus()->getUrl() }}" target="_blank">Google+ ({{ SocShare::gplus()->getCount() }})</a>
<a href="{{ SocShare::pinterest(['media' => asset('/img/pin.png'), 'description' => 'oh hai'])->getUrl() }}" target="_blank">Pin it!</a>
To get share count call getCount() ia your network provider with the same parameters:
<a href="{{ SocShare::pinterest(['media' => asset('/img/pin.png'), 'description' => 'oh hai'])->getUrl() }}" target="_blank">
Already {{ SocShare::pinterest(['media' => asset('/img/pin.png'), 'description' => 'oh hai'])->getCount() }}
</a>
Or go with js to open share dialog in new window:
{{ SocShare::renderJs() }}
<a onclick="{{ SocShare::vk()->getJs() }}" href="javascript:void(0);">Share me</a>
All parameteres listed in config file.