2017-25 © Pedro Peláez
 

library openx-oauth-client

Modern PHP client for working with the OpenX v4 oAuth API

image

vlucas/openx-oauth-client

Modern PHP client for working with the OpenX v4 oAuth API

  • Tuesday, November 4, 2014
  • by vlucas
  • Repository
  • 2 Watchers
  • 1 Stars
  • 197 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 3 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

OpenX oAuth API Client

Uses Guzzle v4.x and the oauth-subscriber plugin., (*1)

Installation

php composer.phar require vlucas/openx-oauth-client

Usage in your code:

// Setup client and login with user
$client = new Vlucas\OpenX($consumerKey, $consumerSecret, $oauthRealm, 'http://ox-ui.example.com/ox/4.0/');
$client->login('user@example.com', 'souper-seekret-password');

// GET /account - for list of accounts
$res = $client->get('account');
var_dump($res->json());

You should see the JSON dumped out for the accounts endpoint. Feel free to make any other requests you want., (*2)

Be sure to read the OpenX API v4 Documentation!, (*3)

Making HTTP Requests

The OpenX client proxies all normal get/post/put/delete, etc. requests through and automatically adds the required Cookie header before sending the request., (*4)

// Makes normal request with necessary Cookie header
$res = $client->get('account');

Access to the Guzzle Client

If you need to get the base Guzzle object to make any further requests or modifications, you can:, (*5)

// Returns the main GuzzleHttp\Client object
$guzzle = $client->getClient();

Please note that if you do this, the required Cookie header will not be attached to your requests automatically, so you will need to do this yourself with $client->getAuthCookie()., (*6)

Using the Example

Steps to run the provided example.php:, (*7)

  1. composer install --dev
  2. cp .env.example .env
  3. Edit .env to add oAuth consumer key and secret, user/pass, etc.
  4. Run it: php example.php

The Versions

04/11 2014

dev-master

9999999-dev https://github.com/vlucas/openx-oauth-client

Modern PHP client for working with the OpenX v4 oAuth API

  Sources   Download

BSD

The Requires

 

The Development Requires

openx openx oauth openx api

04/11 2014