Skip to content

next-sentence/oauth2-php-sdk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

oauth-php-sdk

This PHP - SDK helps developer to connect to REST Api php application via OAuth2.

Example

<?php

use OAuth2\Factory;

require_once __DIR__ . './../vendor/autoload.php';

$config = array(
    'baseUri' => 'htttp://api.example.com',
    'client_id'     => 'client_id',
    'client_secret' => 'client_secret',
    'grant_type'    => 'password',
    'username'    => 'username',
    'password'    => 'password',
);

$factory  = new Factory();
$api = $factory->createApi($config);
try {
    $response = $api->call('v1/users.json', 'GET', $params = array());
    if ('200' == $response->getStatusCode()) {
        $users = json_decode($response->getContent());

        var_dump($users);
    }
} catch (Exception $e) {
    echo $e->getMessage();
}

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages