yaro/soc-share

Social network share link builder
2,009 10
Install
composer require yaro/soc-share
Latest Version:1.0.4
PHP:>=5.4.0
License:MIT
Last Updated:Mar 13, 2017
Links: GitHub  ·  Packagist
Maintainer: Cherry Pie

SocShare

Link builder for social share button for Laravel 5.

Installation

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"

Usage

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.

Related Packages

mannysoft/shareable

A Laravel 4 package to make it easy to add social sharing buttons to your applic...

32 0
hilioski/social-share-and-meta-generator

Share links with Laravel 5 and meta generator

870 1
ryannielson/shareable

A Laravel 4 package to make it easy to add social sharing buttons to your applic...

2,771 22
potelo/shareable

A Laravel 4 package to make it easy to add social sharing buttons to your applic...

11,175 1
nobox/identichip

A Laravel Package for login/registration. Using email and other services.

94 0