PHP code example of sanchobbdo / api-auth-client-plugin

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

    

sanchobbdo / api-auth-client-plugin example snippets




// Include composer's autoload.
Guzzle\Http\Client;

// Use the api_auth plugin.
use SanchoBBDO\Guzzle\Plugin\ApiAuth\ApiAuthPlugin;

// Set up the Guzzle Client.
$client = new Client('http://your-host.com');

// Set up the api_auth plugin. Include your access id and secret key.
$apiAuthPlugin = new ApiAuthPlugin(array(
    'accessId' =>  'your-access-id',
    'secretKey' =>  'your-secret-key'
));

// Subscribe the plugin to client's events.
$client->addSubscriber($apiAuthPlugin);

// Enjoy!