dev-master
9999999-devAn OAuth2 Wrapper for Yammer
MIT
The Development Requires
by Stephen Yeargin
v1.0.0
1.0.0.0An OAuth2 Wrapper for Yammer
MIT
The Development Requires
by Stephen Yeargin
Wallogit.com
2017 © Pedro Peláez
An OAuth2 Wrapper for Yammer
PHP wrapper for Yammer's API., (*2)
Install with Composer:, (*3)
$ composer require stephenyeargin/yammer-oauth2-php
Example configuration array passed to constructor:, (*4)
$config['consumer_key'] = '1ABCdefhiJKLmnop'; $config['consumer_secret'] = 'ABCdefhi_JKLmnop'; $config['callbackUrl'] = 'http://' . $_SERVER['SERVER_NAME'] . '/yammer/callback/'; $yammer = new YammerPHP\YammerPHP($config);
Starting the callback process:, (*5)
// Redirect the user to the OAuth page for your application
header('Location: ' . $yammer->getAuthorizationUrl());
Upgrading the callback code to an authorization token:, (*6)
$code = $_GET['code']; $token = $yammer->getAccessToken($code);
Using the token (either from a fresh process or saved in the database), (*7)
$yammer->setOAuthToken($token);
Making a call with the $yammer instance:, (*8)
if (!$yammer->testAuth()) {
// Handle this.
}
// Retrieve feed for authenticated user
try {
$feed = $yammer->get('messages/my_feed.json');
print_r($feed);
} catch (YammerPHPException $e) {
print 'Error: ';
print $e->getMessage();
}
An OAuth2 Wrapper for Yammer
MIT
An OAuth2 Wrapper for Yammer
MIT