PHP code example of cobwebinfo / shrek-api-client

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

    

cobwebinfo / shrek-api-client example snippets


$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET
]);

$this->app->singleton(\Cobwebinfo\ShrekApiClient\ShrekServiceProvider::class, function() {
            return new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET
            ]);
        });


$keywordClient = $provider->getKeywordClient();

  try {
        $response = $keywordClient->paginate(1, 4, []);
    } catch(IdentityProviderException $e) {
        var_dump('Authentication error: ' . $e->getMessage());
    }

    if($response->wasSuccessful()) {
        foreach($response->body['data']['items'] as $key => $keyword) {
            echo "<h3> $key </h3>";

            var_dump($keyword);
        }
    }


$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'cache_driver' => 'memcache' OR 'apc'
]);

$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'cache_driver' => '\Your\Namespace\ClassName'
]);

$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'http_client' => 'asika'
]);

$provider = new \Cobwebinfo\ShrekApiClient\ShrekServiceProvider([
                'client_id' => YOUR ID,
                'client_secret'=> YOUR SECRET,
                'http_client' => '\Your\Namespace\ClassName'
]);

Yaml::parse(file_get_contents(__DIR__ . '/config.yaml'));;
sh
php composer.phar