PHPackages                             alfthegreatest/laravel\_social-share-buttons - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. alfthegreatest/laravel\_social-share-buttons

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

alfthegreatest/laravel\_social-share-buttons
============================================

Optional package for Laravel to generate social share links.

v1.3.1(4mo ago)035MITPHPPHP ^7.4|^8.0

Since Jan 4Pushed 4mo agoCompare

[ Source](https://github.com/alfthegreatest/laravel_social-share-buttons)[ Packagist](https://packagist.org/packages/alfthegreatest/laravel_social-share-buttons)[ Docs](https://github.com/alfthegreatest/laravel_social-share-buttons)[ RSS](/packages/alfthegreatest-laravel-social-share-buttons/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (6)Dependencies (1)Versions (7)Used By (0)

Laravel Share
=============

[](#laravel-share)

Share links exist on almost every page in every project, creating the code for these share links over and over again can be a pain in the ass. With Laravel Share you can generate these links in just seconds in a way tailored for Laravel.

### Available services

[](#available-services)

- Facebook
- X(Twitter)
- Linkedin
- WhatsApp
- Reddit
- Telegram

Installation via composer:
--------------------------

[](#installation-via-composer)

```
composer require alfthegreatest/laravel_social-share-buttons
```

If you don't use auto-discovery, add the ServiceProvider to the providers array in config/app.php

```
// config/app.php
'providers' => [
    Alfthegreates\Share\Providers\ShareServiceProvider::class,
];
```

And optionally add the facade in config/app.php

```
// config/app.php
'aliases' => [
    'Share' => Alfthegreatest\Share\ShareFacade::class,
];
```

Publish the package config &amp; resource files.

```
php artisan vendor:publish --provider="Alfthegreatest\Share\Providers\ShareServiceProvider"
```

> You might need to republish the config file when updating to a newer version of Laravel Share

This will publish the `laravel-share.php` config file to your config folder, `share.js` in `public/js/` and `laravel-share.php` in your `resources/lang/vendor/en/` folder.

### Fontawesome

[](#fontawesome)

Since this package relies on Fontawesome, you will have to require it's css, js &amp; fonts in your app. You can do that by requesting a embed code [via their website](http://fontawesome.io/get-started/) or by installing it locally in your project.

Laravel share supports Font Awesome v5. For Font Awsome 4 support use version \[3\] of this package.

### Javascript

[](#javascript)

Load jquery.min.js &amp; share.js by adding the following lines to your template files.

```

```

Usage
-----

[](#usage)

### Creating one share link

[](#creating-one-share-link)

#### Facebook

[](#facebook)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons')->facebook();
```

#### X(Twitter)

[](#xtwitter)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Your share text can be placed here')->x();
```

#### Reddit

[](#reddit)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Your share text can be placed here')->reddit();
```

#### Linkedin

[](#linkedin)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Share title')->linkedin('Extra linkedin summary can be passed here')
```

#### Whatsapp

[](#whatsapp)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons')->whatsapp()
```

#### Telegram

[](#telegram)

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Your share text can be placed here')->telegram();
```

### Sharing the current url

[](#sharing-the-current-url)

Instead of manually passing an url, you can opt to use the `currentPage` function.

```
Share::currentPage()->facebook();
```

### Creating multiple share Links

[](#creating-multiple-share-links)

If want multiple share links for (multiple) providers you can just chain the methods like this.

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Share title')
	->facebook()
	->x()
	->linkedin('Extra linkedin summary can be passed here')
	->whatsapp();
```

This will generate the following html

```

```

### Getting the raw links

[](#getting-the-raw-links)

In some cases you may only need the raw links without any html, you can get these by calling the `getRawLinks` method.

**A single link**

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Share title')
	->facebook()
	->getRawLinks();
```

Outputs:

```
https://www.facebook.com/sharer/sharer.php?u=https://github.com/alfthegreatest/laravel_social-share-buttons
```

**Multiple links**

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', 'Share title')
	->facebook()
	->x()
	->linkedin('Extra linkedin summary can be passed here')
	->whatsapp()
    ->getRawLinks();
```

Outputs:

```
[
  "facebook" => "https://www.facebook.com/sharer/sharer.php?u=https://github.com/alfthegreatest/laravel_social-share-buttons",
  "x" => "https://x.com/intent/tweet?text=Share+title&url=https://github.com/alfthegreatest/laravel_social-share-buttons",
  "linkedin" => "http://www.linkedin.com/shareArticle?mini=true&url=https://github.com/alfthegreatest/laravel_social-share-buttons&title=Share+title&summary=Extra+linkedin+summary+can+be+passed+here",
  "whatsapp" => "https://wa.me/?text=https://github.com/alfthegreatest/laravel_social-share-buttons",
]

```

### Optional parameters

[](#optional-parameters)

#### Add extra classes, id's or titles to the social buttons

[](#add-extra-classes-ids-or-titles-to-the-social-buttons)

You can simply add extra class(es), id('s), title(s) or relationship(s) by passing an array as the third parameter on the page method.

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', null, ['class' => 'my-class', 'id' => 'my-id', 'title' => 'my-title', 'rel' => 'nofollow noopener noreferrer'])
    ->facebook();
```

Which will result in the following html

```

```

#### Custom wrapping

[](#custom-wrapping)

By default social links will be wrapped in the following html

```

```

This can be customised by passing the prefix &amp; suffix as a parameter.

```
Share::page('https://github.com/alfthegreatest/laravel_social-share-buttons', null, [], '', '')
            ->facebook();
```

This will output the following html.

```

```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Testing
-------

[](#testing)

```
$ composer test
```

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Aliaksandr Broika](https://github.com/alfthegreatest)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance77

Regular maintenance activity

Popularity9

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

6

Last Release

126d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/ae62866a0559da32e7439b41de474628bf7efc57529b47d19371a702e926583f?d=identicon)[alfthegreatest](/maintainers/alfthegreatest)

---

Top Contributors

[![alfthegreatest](https://avatars.githubusercontent.com/u/38714971?v=4)](https://github.com/alfthegreatest "alfthegreatest (10 commits)")

---

Tags

sharesocial linkssocial share links

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alfthegreatest-laravel-social-share-buttons/health.svg)

```
[![Health](https://phpackages.com/badges/alfthegreatest-laravel-social-share-buttons/health.svg)](https://phpackages.com/packages/alfthegreatest-laravel-social-share-buttons)
```

###  Alternatives

[jorenvanhocht/laravel-share

Optional package for Laravel to generate social share links.

5341.1M5](/packages/jorenvanhocht-laravel-share)[chencha/share

Share links with Laravel

182272.6k](/packages/chencha-share)[social-links/social-links

PHP library to generate share buttons

112338.6k2](/packages/social-links-social-links)[jonom/silverstripe-share-care

Social media sharing previews and customisation for Silverstripe

2932.7k1](/packages/jonom-silverstripe-share-care)[yaro/soc-share

Social network share link builder

101.9k](/packages/yaro-soc-share)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
