Dipesh79 / LaravelShare

Laravel Share. A simple package which allows provide you link to make the current page shareable in different platform.

Home Page:https://dipesh79.github.io/LaravelShare/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Laravel Share Pacakge

Laravel Share

This Laravel package share the current url page to multiple social media channel.

Usage/Examples

Install Using Composer

composer require dipesh79/laravel-share

Compact the Required Social Media Share Link to blade

use Dipesh79\LaravelShare\LaravelShare;

//Your Controller Method
public function index()
{
  $share = new LaravelShare();
  $facebook_link = $share->facebook();
  //This will share the current url
  
  OR
  
  $facebook_link = $share->facebook("custom_url");
  /This will share the given url.
  //compact the share link to your blade
  return view('index',compact('facebook_link'));
}

After sending the url to blade simply add the url to href tag.

<a href="{{$facebook_link}}" target="_blank">Share To Facebook</a>

OR

use Dipesh79\LaravelShare\LaravelShare;

//Your Controller Method
public function index()
{
  $share = new LaravelShare();
 
  //compact the share link to your blade
  return view('index',compact('share'));
}

After sending the url to blade simply add the url to href tag.

<a href="{{$share->facebook()}}" target="_blank">Share To Facebook</a>

If you have to add in most of the blade files then use it in AppServiceProvider.

use Dipesh79\LaravelShare\LaravelShare;
use Illuminate\Support\Facades\View;

.
.
.

public function boot()
{
    $share = new LaravelShare();
    View::share('share',$share);
}

Then you can use share variable in any blade file in the laravel project. Then simply do {{$share->facebook()}} to add respective social media share link in any blade file.

Currently Available Platform

This package provide the following platform sharing functionality.

  • Facebook {{$share->facebook()}}
  • Twitter {{$share->twitter()}}
  • Linkedin {{$share->linkedin()}}
  • Pinterest {{$share->pinterest()}}
  • WhatsApp {{$share->whatsapp()}}
  • Reddit {{$share->reddit()}}
  • Telegram {{$share->telegram()}}
  • Tumblr {{$share->tumblr()}}
  • Viber {{$share->viber()}}
  • Gmail {{$share->gmail()}}
  • Trello {{$share->trello()}}
  • Facebook Messenger {{$share->messenger()}}
  • Skype {{$share->skype()}}
  • Tencent QQ {{$share->qq()}}

More Coming Soon...

Contact Us we have missed any platform which is used mostly, and it would be helpful to add that platform on this project.

License

MIT

Author

Support

For support, email dipeshkhanal79@gmail.com.

About

Laravel Share. A simple package which allows provide you link to make the current page shareable in different platform.

https://dipesh79.github.io/LaravelShare/


Languages

Language:PHP 100.0%