GithubHelp home page GithubHelp logo

stephenyeargin / yammer-oauth2-php Goto Github PK

View Code? Open in Web Editor NEW
10.0 3.0 11.0 34 KB

๐Ÿ—ฃ PHP wrapper for Yammer's API

Home Page: https://packagist.org/packages/stephenyeargin/yammer-oauth2-php

License: MIT License

PHP 100.00%
php yammer oauth2 hacktoberfest

yammer-oauth2-php's Introduction

Yammer OAuth2 for PHP

CI Build and Test

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();
}

yammer-oauth2-php's People

Contributors

afinno avatar ejlofgren avatar stephenyeargin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.