simivar/genius-php 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

simivar/genius-php

最新稳定版本:3.0.0

Composer 安装命令:

composer require simivar/genius-php

包简介

Genius PHP is a open source library that allows you to access Genius API from your PHP application. Supports every resource.

README 文档

README

Genius PHP is a open source library that allows you to access Genius API from your PHP application. It supports oAuth 2 from version 1.0.

Getting started

Genius PHP is avialable via Composer. Version 1.0 does not implement HTTP Client on it's own anymore and uses HTTPlug abstraction so you are free to choose any HTTP Client you want that depends on php-http/client-implementation virutal package.

composer require simivar/genius-php php-http/message php-http/guzzle6-adapter

Static Bearer example

<?php

require_once('vendor/autoload.php');

$authentication = new \Http\Message\Authentication\Bearer('YOUR_ACCESS_TOKEN');

$genius = new \Genius\Genius($authentication);
$upvoteAnnotation = $genius->getAnnotationsResource()->get(11852248);

OAuth2 Example

require_once('vendor/autoload.php');

$authentication = new \Genius\Authentication\OAuth2(
  'YOUR_CLIENT_ID',
  'YOUR_CLIENT_SECRET',
  'YOUR_REDIRECT_URL',
  new \Genius\Authentication\ScopeList([
      \Genius\Enum\Scope::ME(),
      \Genius\Enum\Scope::CREATE_ANNOTATION(),
      \Genius\Enum\Scope::MANAGE_ANNOTATION(),
      \Genius\Enum\Scope::VOTE(),
  ]),
  null
);

$accessTokenFromDatabase = 'get access token from DataBase here';
if ($accessTokenFromDatabase === null) {
    $authorizeUrl = $authentication->getAuthorizeUrl();
    // redirect user to $authorizeUrl
} else {
    $authentication->setAccessToken($accessTokenFromDatabase);
}

$genius = new \Genius\Genius($authentication);
$upvoteAnnotation = $genius->getAnnotationsResource()->get(11852248);

Complete documentation, installation instructions, and examples are available at: http://simivar.github.io/Genius-PHP/.

Versioning

Genius PHP is created using Semver. All minor and patch updates are backwards compatibile. 0.1 branch is no longer maintained.

License

Please see the license file for more information.

统计信息

  • 总下载量: 166.43k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 15
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 14
  • Watchers: 2
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2015-12-05