定制 droidwiki/xenforo-bd-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

droidwiki/xenforo-bd-client

最新稳定版本:0.1.1

Composer 安装命令:

composer require droidwiki/xenforo-bd-client

包简介

A consumer for the XenForo bd Api plugin.

README 文档

README

This library allows to use the public api endpoint of XenForo (XenForo [bd] Api).

Usage

To authenticate an user using the OAuth2 protocol, you can use the following example. You need to create an API client at the target XenForo installation at https://example.com/account/api.

$client = new \XenForoBDClient\Clients\OAuth2Client();
$client->setBaseUrl( 'https://example.com/api/' )
	->setClientId( 'client_id' )
	->setClientSecret( 'client_secret' )
	->setRedirectUri( 'https://example2.com/redirect_target.php' )
	// see \XenForoBD\Scopes for all possible scopes
	->addScope( \XenForoBD\Scopes::READ );
if ( $_GET[ 'code' ] ) {
	$client->authenticate( $_GET['code'] );
	$user = new \XenForoBDClient\Users\User( $client );
	// will print the whole information array of the authenticated user
	var_dump($user->get( 'me' ));
} else {
	// redirect to the authentication url
	header( 'Location: ' . $client->getAuthenticationRequestUrl() );
}

To request information about an user using the user id, without needing to authenticate before doing it (e.g. using OAuth2), you can use the following example code:

$client = new \XenForoBDClient\Clients\UnauthenticatedClient();
$client->setBaseUrl( 'http://www.android-hilfe.de/api/' );
$user = new \XenForoBDClient\Users\User( $client );
// the user id in XenForo would be 102719
var_dump( $user->get( 102719 ) );

统计信息

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

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2016-09-28