All Projects → heiseonline → Shariff Backend Php

heiseonline / Shariff Backend Php

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

Projects that are alternatives of or similar to Shariff Backend Php

Embetty Server
🐙 Proxy and provider of data for heiseonline/embetty
Stars: ✭ 126 (-1.56%)
Mutual labels:  privacy, backend
Eshoponcontainersddd
Fork of dotnet-architecture/eShopOnContainers in full DDD/CQRS design using my own patterns
Stars: ✭ 126 (-1.56%)
Mutual labels:  backend
1972
1972 - Criando APIs com NodeJs
Stars: ✭ 120 (-6.25%)
Mutual labels:  backend
Backend
Backend is responsible to provide data to EVOlution App - iOS
Stars: ✭ 123 (-3.91%)
Mutual labels:  backend
Roll Call
📞 Free and reliable audio calls for everyone w/ browser p2p.
Stars: ✭ 1,563 (+1121.09%)
Mutual labels:  privacy
Cms
MaxSite CMS
Stars: ✭ 123 (-3.91%)
Mutual labels:  backend
Gobetween
☁️ Modern & minimalistic load balancer for the Сloud era
Stars: ✭ 1,631 (+1174.22%)
Mutual labels:  backend
Trackless
Add a GDPR-friendly Google Analytics opt-in/opt-out button to your site
Stars: ✭ 127 (-0.78%)
Mutual labels:  privacy
Cookiescanner
Cookie Scanner for GDPR compliance
Stars: ✭ 126 (-1.56%)
Mutual labels:  privacy
Locationwithoutprompt
A proof of concept to show how easy it is to get coarse location of the user without using Core Location
Stars: ✭ 123 (-3.91%)
Mutual labels:  privacy
Reqman
Reqman is a tool that can quickly help back-end engineers with api testing, as well as a nodejs-based crawler tool.
Stars: ✭ 123 (-3.91%)
Mutual labels:  backend
Whoogle Search
A self-hosted, ad-free, privacy-respecting metasearch engine
Stars: ✭ 4,645 (+3528.91%)
Mutual labels:  privacy
Grapheneos.org
Sources for the GrapheneOS website.
Stars: ✭ 125 (-2.34%)
Mutual labels:  privacy
Hosts.extras
Extra rules for https://github.com/StevenBlack/hosts project
Stars: ✭ 120 (-6.25%)
Mutual labels:  privacy
Databunker
Secure storage for personal records built to comply with GDPR
Stars: ✭ 122 (-4.69%)
Mutual labels:  privacy
Slides
it is a repository to store all slides used by Triton Ho's public presentation and course.
Stars: ✭ 1,782 (+1292.19%)
Mutual labels:  backend
I2pd
🛡 I2P: End-to-End encrypted and anonymous Internet
Stars: ✭ 1,796 (+1303.13%)
Mutual labels:  privacy
Blocker Database
A global domain based database for NoScript, uBlock, uMatrix & ScriptSafe
Stars: ✭ 127 (-0.78%)
Mutual labels:  privacy
Cape Python
Collaborate on privacy-preserving policy for data science projects in Pandas and Apache Spark
Stars: ✭ 125 (-2.34%)
Mutual labels:  privacy
Awesome Humane Tech
Promoting Solutions that Improve Wellbeing, Freedom and Society
Stars: ✭ 2,234 (+1645.31%)
Mutual labels:  privacy

Shariff PHP Backend Build Status Code Climate

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

This document describes the PHP backend of Shariff.

Supported services

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

Requirements

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

  • 7.2
  • 7.3
  • 7.4

Older versions and HHVM are not supported.

Installing the Shariff backend on your own server

To run Shariff under a certain URL, unzip the release 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:

Key Type Description
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.
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

Key Type Description
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.)
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

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

Key Type Description
client object Guzzle request options
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.

Key Type Description
servicename object options for the service
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.

Key Type Description
app_id string the id of your facebook application
secret string the client secret of your facebook application
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

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

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("http://www.heise.de/");
echo $counts["facebook"];
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].