2017 © Pedro Peláez
 

library authoritarian

An OAuth 2 client for PHP with multiple authorization flows support

image

renanivo/authoritarian

An OAuth 2 client for PHP with multiple authorization flows support

  • Monday, December 8, 2014
  • by renanivo
  • Repository
  • 1 Watchers
  • 3 Stars
  • 86 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 4 Versions
  • 2 % Grown

The README.md

Authoritarian

Build Status Code Climate Test Coverage, (*1)

An OAuth 2 client for PHP with multiple authorization flows support, (*2)

Install

Get composer and execute:, (*3)

php composer.phar require renanivo/authoritarian

Usage

Just setup your flow and request an access token:, (*4)

Client Credentials Flow

<?php
use Authoritarian\OAuth2;
use Authoritarian\Flow\ClientCredentialsFlow;

$flow = new ClientCredentialsFlow();
$flow->setClientCredential('client id', 'client secret');

$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();

Authorization-Code Flow

in the login page:, (*5)

<?php
use Authoritarian\OAuth2;
use Authoritarian\Flow\AuthorizationCodeFlow;

$flow = new AuthorizationCodeFlow();
$flow->setAuthorizationUrl('http://example.com/oauth/authorize');
$flow->setClientCredential('client id', 'client secret');
$flow->setRedirectUri('http://example.com/callback');

header('Location: ' . $flow->getAuthUrl());

in the callback page:, (*6)

<?php
use Authoritarian\OAuth2;
use Authoritarian\Flow\AuthorizationCodeFlow;

$flow = new AuthorizationCodeFlow();
$flow->setClientCredential('client id', 'client secret');
$flow->setCode($_GET['code']);

$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();

Resource Owner Password

<?php
use Authoritarian\OAuth2;
use Authoritarian\Flow\ResourceOwnerPasswordFlow;

$flow = new ResourceOwnerPasswordFlow(
    'username',
    'password'
);
$flow->setClientCredential('client id', 'client secret');

$oauth2 = new OAuth2('http://example.com/oauth/token');
$token = $oauth2->requestAccessToken($flow)->json();

Generate Docs

  • Download apigen.phar:, (*7)

    curl -sS http://apigen.org/installer | php
    
  • Run ApiGen:, (*8)

    php apigen.phar generate
    

The Versions

08/12 2014

dev-master

9999999-dev

An OAuth 2 client for PHP with multiple authorization flows support

  Sources   Download

MIT

The Requires

 

The Development Requires

by Renan Ivo

19/11 2013

0.0.3

0.0.3.0

An OAuth 2 client for PHP with multiple authorization flows support

  Sources   Download

MIT

The Requires

 

The Development Requires

by Renan Ivo

01/11 2013

0.0.2

0.0.2.0

An OAuth 2 client for PHP with multiple authorization flows support

  Sources   Download

MIT

The Requires

 

The Development Requires

by Renan Ivo

01/11 2013

0.0.1

0.0.1.0

An OAuth 2 client for PHP with multiple authorization flows support

  Sources   Download

MIT

The Requires

 

The Development Requires

by Renan Ivo