PHP code example of heise / shariff

1. Go to this page and download the library: Download heise/shariff library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

heise / shariff example snippets


/**
 * Sample configuration
 *
 * @var array
 */
private static $configuration = [
    'cacheClass' => 'Heise\\Shariff\\ZendCache',
    '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',
        'LinkedIn',
        'Reddit',
        'StumbleUpon',
        'Flattr',
        'Pinterest',
        'Xing',
        'AddThis',
        'Vk'
    ],
    'Facebook' => [
      'app_id' => '1234567890',
      'secret' => 'terces'
    ]
];

use Heise\Shariff\Backend;

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