sanchobbdo/api-auth-client-plugin

Guzzle authentication plugin for Ruby's api_auth gem.

1.0.0 2013-02-07 18:54 UTC

This package is not auto-updated.

Last update: 2024-04-13 11:30:47 UTC


README

Guzzle authentication plugin for mgomes' Ruby api_auth gem.

Installing

Create a composer.json file in the project root:

{
    "require": {
        "sanchobbdo/api-auth-client-plugin": "~1.0.0",
        "guzzle/guzzle": "~3.1"
    }
}

Then download composer.phar and run the install command:

curl -s http://getcomposer.org/installer | php && ./composer.phar install

Usage

<?php

// Include composer's autoload.
require 'vendor/autoload.php';

// Use required Guzzle classess.
use 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!

License

Licensed under the MIT License.