PHPackages                             erkenes/heise-shariff - 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. erkenes/heise-shariff

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

erkenes/heise-shariff
=====================

PHP backend for Shariff. Shariff enables website users to share their favorite content without compromising their privacy.

10.0.0(3y ago)09333[1 PRs](https://github.com/erkenes-archive/shariff-backend-php/pulls)MITPHPPHP ^7.4 || ^8.0

Since Nov 11Pushed 3y agoCompare

[ Source](https://github.com/erkenes-archive/shariff-backend-php)[ Packagist](https://packagist.org/packages/erkenes/heise-shariff)[ Docs](https://github.com/erkenes/shariff-backend-php)[ RSS](/packages/erkenes-heise-shariff/feed)WikiDiscussions main Synced 1mo ago

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

Shariff PHP Backend [![Build Status](https://camo.githubusercontent.com/4beec6d94cb1e049f520f0f23719ad4e41ac34b044124a84d0393f325695ad14/68747470733a2f2f7472617669732d63692e6f72672f68656973656f6e6c696e652f736861726966662d6261636b656e642d7068702e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/heiseonline/shariff-backend-php) [![Code Climate](https://camo.githubusercontent.com/7ab07b38902437c081fe7ca6987b324fcbb66f59b1b5c8dd3d1ed0c38d402ba6/68747470733a2f2f636f6465636c696d6174652e636f6d2f6769746875622f68656973656f6e6c696e652f736861726966662d6261636b656e642d7068702f6261646765732f6770612e737667)](https://codeclimate.com/github/heiseonline/shariff-backend-php)
==================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================================

[](#shariff-php-backend--)

Shariff is used to determine how often a page is shared in social media, but without generating requests from the displaying page to the social sites.

[![Shariff Logo © 2014 Heise Zeitschriften Verlag](https://camo.githubusercontent.com/d7a1f01a47b815c253c8c67ae49042e4d04b2a1677544fd7c889d1755936162d/687474703a2f2f7777772e68656973652e64652f69636f6e732f686f2f736861726966662d6c6f676f2e706e67)](https://camo.githubusercontent.com/d7a1f01a47b815c253c8c67ae49042e4d04b2a1677544fd7c889d1755936162d/687474703a2f2f7777772e68656973652e64652f69636f6e732f686f2f736861726966662d6c6f676f2e706e67)

This document describes the PHP backend of Shariff.

Supported services
------------------

[](#supported-services)

- AddThis
- Buffer
- Facebook
- Flattr
- Pinterest
- Reddit
- StumbleUpon
- Xing
- Vk

Requirements
------------

[](#requirements)

To run Shariff PHP Backend on your server you need one of these PHP versions:

- 7.2
- 7.3
- 7.4
- 8.0
- 8.1

Older versions and HHVM are not supported.

Installing the Shariff backend on your own server
-------------------------------------------------

[](#installing-the-shariff-backend-on-your-own-server)

To run Shariff under a certain URL, unzip the [release](https://github.com/heiseonline/shariff-backend-php/releases) zip file into a directory under the document root of your web server.

Take a look into the demo application in the `index.php` file and adjust the configuration as necessary.

The following configuration options are available:

KeyTypeDescription`cacheClass``string`*Optional* Cache class name. Has to implement `Heise\Shariff\CacheInterface`. Defaults to internal Laminas Cache.`cache``object`File cache settings, which are passed on to the Cache class. See description below.`domains``array`Domains for which share counts may be requested. If empty, all domains are allowed.`services``array`List of services to be enabled. See [Supported services](#supported-services).##### Cache settings:

[](#cache-settings)

By default Shariff uses the Filesystem cache. By specifying a different adapter from Laminas\\Cache\\Storage\\Adapter you can tell Shariff to use another cache. Also you can specify options for that cache adapter

KeyTypeDescription`ttl``integer`Time that the counts are cached (in seconds)`cacheDir``string`Directory used for the cache. Default: system temp directory`adapter``string`Name of cache adapter (e.g. Apc, Memcache, etc.)
You can find an overview of all available Adapters [here](https://docs.laminas.dev/laminas-cache/v3/storage/adapter/). It is required to [install these separately](https://docs.laminas.dev/laminas-cache/v3/migration/to-version-3/#satellite-packages) through composer`adapterOptions``object`Options for the cache adapter*These option apply for the default Cache class (`LaminasCache`) only. If you implement custom caching, you can specify your own options.*

##### Client options

[](#client-options)

The backend uses [Guzzle](http://docs.guzzlephp.org/en/latest/) as HTTP client. Guzzle has many options that you can set, e.g. timeout and connect\_timeout. See  for a detailed list. In order to set those options pass them in the json with the key "client".

KeyTypeDescription`client``object`Guzzle request options##### Service Settings

[](#service-settings)

To pass config options to a service, you can add them to the json as well under the name of the service. Currently only the Facebook service has options for an facebook application id and client secret in order to use the graph api id method to get the current share count.

KeyTypeDescription`servicename``object`options for the service##### Facebook service options

[](#facebook-service-options)

To use the graph api id method to fetch the share count you need to set up an application at facebook.com and pass in the application id and client secret to the options. It seems that the id method returns the most current share count, but it can be only used with an registered application.

KeyTypeDescription`app_id``string`the id of your facebook application`secret``string`the client secret of your facebook application##### Full config example

[](#full-config-example)

```
use Heise\Shariff\LaminasCache;
/**
 * Sample configuration
 *
 * @var array
 */
private static $configuration = [
    'cacheClass' => 'Heise\\Shariff\\LaminasCache',
    'cache' => [
        'ttl' => 60,
        'cacheDir' => '/tmp/shariff/cache',
        'adapter' => 'Filesystem',
        'adapterOptions' => [
          // ...
        ]
    ],
    'client' => [
      'timeout' => 4.2
      // ... (see "Client options")
    ],
    'domains' => [
        'www.heise.de',
        'www.ct.de'
    ],
    'services' => [
        'Facebook',
        'Reddit',
        'StumbleUpon',
        'Flattr',
        'Pinterest',
        'Xing',
        'AddThis',
        'Buffer',
        'Vk'
    ],
    'Facebook' => [
      'app_id' => '1234567890',
      'secret' => 'terces'
    ]
];
```

Testing your installation
-------------------------

[](#testing-your-installation)

If the backend runs under `http://example.com/my-shariff-backend/`, calling the URL `http://example.com/my-shariff-backend/?url=http%3A%2F%2Fwww.example.com` should return a JSON structure with numbers in it, e.g.:

```
{"facebook":1452,"reddit":7,"stumbleupon":4325,"flattr":0,"pinterest":3,"addthis":33,"buffer":29,"vk":326}
```

Shariff OO interface
--------------------

[](#shariff-oo-interface)

If you need more control, you can invoke Shariff in your own PHP code. The following snippet should get you started. `$options` are identical to those described above.

```
use Heise\Shariff\Backend;

$options = [
	"domains"  => ["www.heise.de", "www.ct.de"],
	"cache"    => ["ttl" => 1],
	"services" => ["Facebook", "Reddit", "StumbleUpon", "Flattr", "Pinterest", "AddThis", "Buffer", "Vk"]
];
$shariff = new Backend($options);
$counts = $shariff->get("https://www.heise.de/");
echo $counts["facebook"];
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 53.4% 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 ~63 days

Recently: every ~248 days

Total

46

Last Release

1322d ago

Major Versions

5.2.4 → 6.0.02016-08-16

6.0.1 → 7.0.02017-03-30

7.1.4 → 8.0.02018-11-29

8.2.2 → 9.0.02020-02-24

9.0.2 → 10.0.02022-09-28

PHP version history (6 changes)1.0.0PHP &gt;=5.4.0

4.0.0PHP &gt;=5.5.0

6.0.1PHP ^5.6 || ^7.0

8.0.0PHP ^7.1

9.0.0PHP ^7.2

10.0.0PHP ^7.4 || ^8.0

### Community

Maintainers

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

---

Top Contributors

[![compeak](https://avatars.githubusercontent.com/u/1942208?v=4)](https://github.com/compeak "compeak (218 commits)")[![pmb0](https://avatars.githubusercontent.com/u/2140915?v=4)](https://github.com/pmb0 "pmb0 (53 commits)")[![lbehm](https://avatars.githubusercontent.com/u/421093?v=4)](https://github.com/lbehm "lbehm (37 commits)")[![liayn](https://avatars.githubusercontent.com/u/222377?v=4)](https://github.com/liayn "liayn (29 commits)")[![richard67](https://avatars.githubusercontent.com/u/7413183?v=4)](https://github.com/richard67 "richard67 (22 commits)")[![core23](https://avatars.githubusercontent.com/u/3440437?v=4)](https://github.com/core23 "core23 (18 commits)")[![uwej711](https://avatars.githubusercontent.com/u/648874?v=4)](https://github.com/uwej711 "uwej711 (10 commits)")[![erkenes](https://avatars.githubusercontent.com/u/8766722?v=4)](https://github.com/erkenes "erkenes (4 commits)")[![vkhramtsov](https://avatars.githubusercontent.com/u/5517373?v=4)](https://github.com/vkhramtsov "vkhramtsov (3 commits)")[![yanniks](https://avatars.githubusercontent.com/u/993397?v=4)](https://github.com/yanniks "yanniks (2 commits)")[![sehkunde](https://avatars.githubusercontent.com/u/8555890?v=4)](https://github.com/sehkunde "sehkunde (2 commits)")[![NeoBlack](https://avatars.githubusercontent.com/u/1128085?v=4)](https://github.com/NeoBlack "NeoBlack (1 commits)")[![cmb69](https://avatars.githubusercontent.com/u/2306138?v=4)](https://github.com/cmb69 "cmb69 (1 commits)")[![ipa01](https://avatars.githubusercontent.com/u/9677305?v=4)](https://github.com/ipa01 "ipa01 (1 commits)")[![kriskbx](https://avatars.githubusercontent.com/u/3148865?v=4)](https://github.com/kriskbx "kriskbx (1 commits)")[![markusschwarz](https://avatars.githubusercontent.com/u/9694683?v=4)](https://github.com/markusschwarz "markusschwarz (1 commits)")[![Art4](https://avatars.githubusercontent.com/u/2162994?v=4)](https://github.com/Art4 "Art4 (1 commits)")[![ooxi](https://avatars.githubusercontent.com/u/2611835?v=4)](https://github.com/ooxi "ooxi (1 commits)")[![reiz](https://avatars.githubusercontent.com/u/652130?v=4)](https://github.com/reiz "reiz (1 commits)")[![wmtech-1](https://avatars.githubusercontent.com/u/13788345?v=4)](https://github.com/wmtech-1 "wmtech-1 (1 commits)")

---

Tags

shariffheisesocial buttons

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/erkenes-heise-shariff/health.svg)

```
[![Health](https://phpackages.com/badges/erkenes-heise-shariff/health.svg)](https://phpackages.com/packages/erkenes-heise-shariff)
```

###  Alternatives

[heise/shariff

PHP backend for Shariff. Shariff enables website users to share their favorite content without compromising their privacy.

139152.5k9](/packages/heise-shariff)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

728272.9k20](/packages/civicrm-civicrm-core)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

255.2k](/packages/aedart-athenaeum)[ralphjsmit/laravel-helpers

A package containing handy helpers for your Laravel-application.

13704.6k2](/packages/ralphjsmit-laravel-helpers)

PHPackages © 2026

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