PHP code example of erkenes / heise-shariff

1. Go to this page and download the library: Download erkenes/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/ */

    

erkenes / heise-shariff example snippets


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'
    ]
];

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"];