Download the PHP package heise/shariff without Composer

On this page you can find all versions of the php package heise/shariff. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package shariff

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

Requirements

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

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.)
You can find an overview of all available Adapters here. It is required to install these separately 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

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

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.:

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.


All versions of shariff with dependencies

PHP Build Version
Package Version
Requires php Version ^7.4 || ^8.0 <8.2
guzzlehttp/guzzle Version ^7.4.1
psr/log Version ^1.0
laminas/laminas-cache Version ^3.1
laminas/laminas-cache-storage-adapter-filesystem Version ^2.0
laminas/laminas-cache-storage-adapter-memory Version ^2.0
laminas/laminas-cache-storage-deprecated-factory Version ^1.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package heise/shariff contains the following files

Loading the files please wait ....