PHPackages                             rezozero/social-links - 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. rezozero/social-links

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

rezozero/social-links
=====================

Provide social network url for sharing.

v2.0.0(2y ago)155.7k↓25%4[1 issues](https://github.com/rezozero/social-links/issues)1MITPHPPHP &gt;=7.4

Since Jan 15Pushed 2y ago3 watchersCompare

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

READMEChangelog (1)Dependencies (2)Versions (13)Used By (1)

Social links
============

[](#social-links)

[![License](https://camo.githubusercontent.com/8984dd387bb56f3f9cea0d7390e1b8385d8dd487f8ca355ba9b1f04f198eb7cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72657a6f7a65726f2f736f6369616c2d6c696e6b732e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/8984dd387bb56f3f9cea0d7390e1b8385d8dd487f8ca355ba9b1f04f198eb7cd/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f72657a6f7a65726f2f736f6369616c2d6c696e6b732e7376673f7374796c653d666c6174)[![Version](https://camo.githubusercontent.com/b3184e8fb3fd8c43041aca5a787f061be3740ed1d78adc9cad3cebe274453a96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72657a6f7a65726f2f736f6369616c2d6c696e6b732e7376673f7374796c653d666c6174)](https://camo.githubusercontent.com/b3184e8fb3fd8c43041aca5a787f061be3740ed1d78adc9cad3cebe274453a96/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72657a6f7a65726f2f736f6369616c2d6c696e6b732e7376673f7374796c653d666c6174)

[![Examples using Font awesome and bootstrap](test/examples.png)](test/examples.png)

Usage
-----

[](#usage)

Install *SocialLinks* using *Composer*

```
composer require rezozero/social-links
```

Configure your `SocialLinks` instance with your data source and some output settings. [Load *fontawesome* CSS](https://cdnjs.com/libraries/font-awesome) (base, regular and brands minimum) files in your HTML page.

```
// Construct a new SocialLinks
$share = new \RZ\SocialLinks\SocialLinks(array(
    'url' => 'http://www.rezo-zero.com',
    'title' => 'REZO ZERO website homepage',
    // Optional image source url for pinterest. must be at least 200px by 200px, if you intent to use for facebook
    'imageUrl' => 'http://www.rezo-zero.com/templates/rezo-zero/img/apple-icon.png',
    // Optional status for overriding title for twitter, whatsapp and emails body
    'status' => 'Hey! Look at this awesome website.'
));

// Set link class prefix
$share->setClassPrefix('social-link');

// Set social icons class prefix
// Use fa for Font Awesome or an
// other for a custom icon set.
$share->setIconPrefix('fa');

// Optional:
// Set link additional classes, for example
// to add "btn" bootstrap classes.
$share->setLinkClasses('btn btn-default');
```

### Single Url

[](#single-url)

```
echo $share->getUrl('twitter');

// https://twitter.com/intent/tweet?text=Hey%21%20Look%20at%20this%20awesome%20website.%20%E2%80%94%20http%3A%2F%2Fwww.rezo-zero.com
```

### Single Link with icon

[](#single-link-with-icon)

```
$share->setClassPrefix('social-link');
$share->setIconPrefix('fa');
echo $share->getLink('facebook', $share->getIcon('facebook'));

// Facebook
```

### Single Link with SVG tag

[](#single-link-with-svg--tag)

```
$share->setClassPrefix('social-link');
$share->setIconPrefix('fa');
echo $share->getLink('facebook', $share->getUseSVG('facebook'));

// Facebook
```

### A bunch of links with their icons

[](#a-bunch-of-links-with-their-icons)

Without icons:

```
echo $share->getLinks(array('facebook', 'twitter', 'linked-in'));
```

With `` icons:

```
echo $share->getLinksWithIcon(array('facebook', 'twitter', 'linked-in'));
```

With `` icons:

```
echo $share->getLinksWithSVG(array('facebook', 'twitter', 'linked-in'));
```

You also can choose a not empty separator, i.e. a dash:

```
echo $share->getLinksWithIcon(array('facebook', 'twitter', 'linked-in'), ' - ');
```

Available networks
------------------

[](#available-networks)

- delicious
- digg
- email
- evernote
- facebook (*sharer* by default, or */dialog/feed* if you provide a `facebookAppId`), if you use default *font-awesome* icon prefix, icon class will be `facebook-official`. It’s still `facebook` for SVG icons or *non font-awesome* prefix.
- friendfeed
- google
- google-plus
- linked-in
- newsvine
- pinterest
- pocket
- reddit
- scoop-it
- slashdot
- stumbleupon
- tumblr
- twitter
- whatsapp

Twig extension
--------------

[](#twig-extension)

```
$twig->addExtension(new \RZ\SocialLinks\Twig\SocialLinksExtension());
```

`SocialLinksExtension` *Twig* extension introduces 3 new filters to be able to generate your social links without any PHP code.

- `social_links`
- `icon_social_links`
- `svg_social_links`
- `tweet_links`

First you’ll need to gather your social data in an associative array or simply `set` a string variable (it will be used as the URL).

```
{% set social_data = {
    'url': 'http://www.rezo-zero.com',
    'title': 'REZO ZERO website homepage',
} %}
{# or #}
{% set social_data = 'http://www.rezo-zero.com' %}
```

Then, you can use one of the 3 *SocialLinks* filters with or without optional arguments. Selected networks can be set using an array or a simple string.

```

    {{ social_data|social_links(['facebook', 'twitter']) }}

    {{ social_data|social_links('twitter') }}

    {{ social_data|icon_social_links(
        ['facebook', 'twitter'],
        'icon-prefix',
        'class-prefix',
        'link-classes',
        'Share on %s'
    ) }}

```

Bonus: `tweet_links` is a Twig filter to parse your tweets contents.

Translate share action label
----------------------------

[](#translate-share-action-label)

We introduced `shareActionLabel` argument to provide `title` for accessibility on your social links. You can override it in your own *Twig* template to change the `title` and translate it:

```

    {{ social_data|icon_social_links(
        ['facebook', 'twitter'],
        'icon-prefix',
        'class-prefix',
        'link-classes',
        ('share_on_%s'|trans)
    ) }}

```

###  Health Score

37

—

LowBetter than 83% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity31

Limited adoption so far

Community16

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 88.6% 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 ~312 days

Recently: every ~481 days

Total

10

Last Release

959d ago

Major Versions

v0.1.1 → v1.0.02016-12-27

v1.5.0 → v2.0.02023-09-26

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/380026?v=4)[Ambroise Maupate](/maintainers/ambroisemaupate)[@ambroisemaupate](https://github.com/ambroisemaupate)

---

Top Contributors

[![ambroisemaupate](https://avatars.githubusercontent.com/u/380026?v=4)](https://github.com/ambroisemaupate "ambroisemaupate (31 commits)")[![Gouterman](https://avatars.githubusercontent.com/u/5153461?v=4)](https://github.com/Gouterman "Gouterman (2 commits)")[![holymp2006](https://avatars.githubusercontent.com/u/13824510?v=4)](https://github.com/holymp2006 "holymp2006 (2 commits)")

###  Code Quality

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/rezozero-social-links/health.svg)

```
[![Health](https://phpackages.com/badges/rezozero-social-links/health.svg)](https://phpackages.com/packages/rezozero-social-links)
```

###  Alternatives

[stfalcon/tinymce-bundle

This Bundle integrates TinyMCE WYSIWYG editor into a Symfony2 project.

2692.9M24](/packages/stfalcon-tinymce-bundle)[codefog/contao-haste

haste extension for Contao Open Source CMS

42650.8k139](/packages/codefog-contao-haste)[spomky-labs/pwa-bundle

Progressive Web App Manifest Generator Bundle for Symfony.

6144.4k1](/packages/spomky-labs-pwa-bundle)[netgen/content-browser

Netgen Content Browser is a Symfony bundle that provides an interface which selects items from any kind of backend and returns the IDs of selected items back to the calling code.

14112.1k8](/packages/netgen-content-browser)[leapt/core-bundle

Symfony LeaptCoreBundle

2529.1k4](/packages/leapt-core-bundle)

PHPackages © 2026

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