stephenyeargin/yammer-oauth2-php
最新稳定版本:v1.0.0
Composer 安装命令:
composer require stephenyeargin/yammer-oauth2-php
包简介
An OAuth2 Wrapper for Yammer
README 文档
README
PHP wrapper for Yammer's API.
Install
Install with Composer:
$ composer require stephenyeargin/yammer-oauth2-php
Usage
Example configuration array passed to constructor:
$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:
// Redirect the user to the OAuth page for your application header('Location: ' . $yammer->getAuthorizationUrl());
Upgrading the callback code to an authorization token:
$code = $_GET['code']; $token = $yammer->getAccessToken($code);
Using the token (either from a fresh process or saved in the database)
$yammer->setOAuthToken($token);
Making a call with the $yammer instance:
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(); }
统计信息
- 总下载量: 10.53k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 10
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2015-11-06