PHPackages                             fhsnando/laravel-share - 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. fhsnando/laravel-share

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

fhsnando/laravel-share
======================

Optional package for Laravel to generate social share links with new options.

00PHP

Since Feb 8Pushed 3y agoCompare

[ Source](https://github.com/fhsnando/laravel-share)[ Packagist](https://packagist.org/packages/fhsnando/laravel-share)[ RSS](/packages/fhsnando-laravel-share/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

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

[](#laravel-share)

[![Latest Version on Packagist](https://camo.githubusercontent.com/dc8c85eb98332b43ba376399fb0a7b9ed28b7613421b519e159002c7e703abb8/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6a6f72656e76616e686f6368742f6c61726176656c2d73686172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jorenvanhocht/laravel-share)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE.md)[![Build Status](https://camo.githubusercontent.com/77a324169798b8117293ff1b6e848fd9e3e16a199b7b827e7b126f8b85c6e411/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f6a6f72656e76682f6c61726176656c2d73686172652f6d61737465722e7376673f7374796c653d666c61742d737175617265)](https://travis-ci.org/jorenvh/laravel-share)[![SensioLabsInsight](https://camo.githubusercontent.com/7aeed52df9c635cb4b758398f5e9420d5ed637fb7c79fb40cb49e7714e2649c2/68747470733a2f2f696d672e736869656c64732e696f2f73656e73696f6c6162732f692f64646536303038622d636363362d346133662d386139382d3337643736353332663935362e7376673f7374796c653d666c61742d737175617265)](https://insight.sensiolabs.com/projects/dde6008b-ccc6-4a3f-8a98-37d76532f956)[![Total Downloads](https://camo.githubusercontent.com/74a3780d65c3b1ebc6e05acad12500054a08224d5507b8111aad6a8c64324a36/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6a6f72656e76616e686f6368742f6c61726176656c2d73686172652e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/jorenvanhocht/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
- Twitter
- Linkedin
- WhatsApp
- Reddit
- Telegram

Installation
------------

[](#installation)

You can install the package via composer:

```
composer require fhsnando/laravel-share
```

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

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

And optionally add the facade in config/app.php

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

Publish the package config &amp; resource files.

```
php artisan vendor:publish --provider="fhsnando\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](https://github.com/jorenvh/laravel-share/tree/3.3.1) 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('http://jorenvanhocht.be')->facebook();
```

#### Twitter

[](#twitter)

```
Share::page('http://jorenvanhocht.be', 'Your share text can be placed here')->twitter();
```

#### Reddit

[](#reddit)

```
Share::page('http://jorenvanhocht.be', 'Your share text can be placed here')->reddit();
```

#### Linkedin

[](#linkedin)

```
Share::page('http://jorenvanhocht.be', 'Share title')->linkedin('Extra linkedin summary can be passed here')
```

#### Whatsapp

[](#whatsapp)

```
Share::page('http://jorenvanhocht.be')->whatsapp()
```

#### Telegram

[](#telegram)

```
Share::page('http://jorenvanhocht.be', '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('http://jorenvanhocht.be', 'Share title')
	->facebook()
	->twitter()
	->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('http://jorenvanhocht.be', 'Share title')
	->facebook()
	->getRawLinks();
```

Outputs:

```
https://www.facebook.com/sharer/sharer.php?u=http://jorenvanhocht.be
```

**Multiple links**

```
Share::page('http://jorenvanhocht.be', 'Share title')
	->facebook()
	->twitter()
	->linkedin('Extra linkedin summary can be passed here')
	->whatsapp()
    ->getRawLinks();
```

Outputs:

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

```

### 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('http://jorenvanhocht.be', 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('http://jorenvanhocht.be', 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)

- [Joren Van Hocht](https://github.com/jorenvh)
- [All Contributors](../../contributors)

License
-------

[](#license)

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

###  Health Score

14

—

LowBetter than 2% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity0

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity23

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a0b56cd13166d044e721ab03e56c2b82dcf5754cdbfebed27cf74571787aef0?d=identicon)[fhsnando](/maintainers/fhsnando)

---

Top Contributors

[![jorenvh](https://avatars.githubusercontent.com/u/8791625?v=4)](https://github.com/jorenvh "jorenvh (44 commits)")[![pqrs](https://avatars.githubusercontent.com/u/1423685?v=4)](https://github.com/pqrs "pqrs (30 commits)")[![sandervankasteel](https://avatars.githubusercontent.com/u/17492906?v=4)](https://github.com/sandervankasteel "sandervankasteel (25 commits)")[![fhsnando](https://avatars.githubusercontent.com/u/10979498?v=4)](https://github.com/fhsnando "fhsnando (4 commits)")[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (3 commits)")[![rabol](https://avatars.githubusercontent.com/u/1177191?v=4)](https://github.com/rabol "rabol (3 commits)")[![usernotnull](https://avatars.githubusercontent.com/u/15612814?v=4)](https://github.com/usernotnull "usernotnull (2 commits)")[![leMaur](https://avatars.githubusercontent.com/u/2118799?v=4)](https://github.com/leMaur "leMaur (2 commits)")[![samuelhgf](https://avatars.githubusercontent.com/u/16768378?v=4)](https://github.com/samuelhgf "samuelhgf (2 commits)")[![easoblue](https://avatars.githubusercontent.com/u/77021478?v=4)](https://github.com/easoblue "easoblue (1 commits)")[![faustbrian](https://avatars.githubusercontent.com/u/22145591?v=4)](https://github.com/faustbrian "faustbrian (1 commits)")[![timopaul](https://avatars.githubusercontent.com/u/16575322?v=4)](https://github.com/timopaul "timopaul (1 commits)")[![kudashevs](https://avatars.githubusercontent.com/u/15892462?v=4)](https://github.com/kudashevs "kudashevs (1 commits)")

### Embed Badge

![Health badge](/badges/fhsnando-laravel-share/health.svg)

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

###  Alternatives

[phpjuice/slopeone

PHP implementation of the Weighted Slope One rating-based collaborative filtering scheme.

868.7k](/packages/phpjuice-slopeone)[thisisbd/silverstripe-fontawesome-iconpickerfield

Font Awesome Icon Picker for SilverStripe 3.1.x based on http://mjolnic.com/fontawesome-iconpicker

143.3k1](/packages/thisisbd-silverstripe-fontawesome-iconpickerfield)

PHPackages © 2026

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