How to Add Social Media Share Buttons in Laravel?

https://www.itsolutionstuff.com/post/how-to-add-social-media-share-buttons-in-laravelexample.html

How to Add Social Media Share Buttons in Laravel?

By Hardik Savani July 16, 2021 Category : LaravelPlayUnmuteLoaded: 0.17%FullscreenVDO.AIHi,

In this tutorial, i will show you laravel social media share buttons. I’m going to show you about social media share buttons laravel. We will look at example of how to add social media share buttons in laravel. if you have question about laravel social share buttons then i will give simple example with solution. Let's get started with jorenvanhocht laravel share example.

Here we will use jorenvanhocht/laravel-share composer package for adding social media sharing buttons in laravel project. you can easily use this example with laravel 6, laravel 7, laravel 8 and laravel 9. jorenvanhocht/laravel-share provide social sharing option for facebook, twitter, linkedin, telegram, whatsapp and reddit.

Let's see step by step bellow simple example and will get bellow layout:

Preview:

Step 1: Install jorenvanhocht/laravel-share Package

in first step, we need install jorenvanhocht/laravel-share composer package so let's use bellow command to install:

after installing successfully, we need to publish configuration file using bellow command:

Above command will create laravel-share.php config file on config folder and share.js in public/js/ folder.

Step 2: Create Route

In this is step we need to create some routes for social share example view.

routes/web.php

Read Also: Laravel 8 Queue Step by Step Tutorial Example

Step 3: Create Controller

in this step, we need to create SocialShareController and add following code on that file:

app/Http/Controllers/SocialShareController.php

Step 4: Create Blade Files

here, we need to create blade files for socialshare. so let's create one by one files:

here will code for navbar links:

resources/views/socialshare.blade.php

Now we are ready to run our example. so run bellow command so quick run:

Now you can open bellow URL on your browser:

Read Also: Laravel File Manager Tutorial Step by Step

I hope it can help you...

Last updated

Was this helpful?