dev-master
9999999-devShare links with Laravel 4
MIT
The Requires
- php >=5.3.0
- illuminate/support 4.x
laravel laravel4 share
Wallogit.com
2017 © Pedro Peláez
Share links with Laravel 4
Share links with Laravel 4, (*1)
Add thujohn/share to composer.json., (*3)
"thujohn/share": "dev-master"
Run composer update to pull down the latest version of Share., (*4)
Now open up app/config/app.php and add the service provider to your providers array., (*5)
'providers' => array(
'Thujohn\Share\ShareServiceProvider',
)
Now add the alias., (*6)
'aliases' => array(
'Share' => 'Thujohn\Share\ShareFacade',
)
Get a link (example with Twitter), (*7)
Route::get('/', function()
{
return Share::load('http://www.example.com', 'My example')->twitter();
});
Returns a string :, (*8)
https://twitter.com/intent/tweet?url=http%3A%2F%2Fwww.example.com&text=Link+description
Get many links, (*9)
Route::get('/', function()
{
return Share::load('http://www.example.com', 'Link description')->services('facebook', 'gplus', 'twitter');
});
Returns an array :, (*10)
{"facebook":"https:\/\/www.facebook.com\/sharer\/sharer.php?u=http%3A%2F%2Fwww.example.com&title=Link+description","gplus":"https:\/\/plus.google.com\/share?url=http%3A%2F%2Fwww.example.com","twitter":"https:\/\/twitter.com\/intent\/tweet?url=http%3A%2F%2Fwww.example.com&text=Link+description"}
Share links with Laravel 4
MIT
laravel laravel4 share