2017 © Pedro Peláez
 

library xenforo-bd-client

A consumer for the XenForo bd Api plugin.

image

droidwiki/xenforo-bd-client

A consumer for the XenForo bd Api plugin.

  • Tuesday, May 16, 2017
  • by FlorianSW
  • Repository
  • 1 Watchers
  • 0 Stars
  • 395 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 1 % Grown

The README.md

XenForo bd PHP Client

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

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., (*2)

$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:, (*3)

$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 ) );

The Versions

16/05 2017

dev-master

9999999-dev

A consumer for the XenForo bd Api plugin.

  Sources   Download

MIT

The Requires

 

by Florian Schmidt

16/05 2017

0.1.1

0.1.1.0

A consumer for the XenForo bd Api plugin.

  Sources   Download

MIT

The Requires

 

by Florian Schmidt

02/10 2016

0.1.0

0.1.0.0

A consumer for the XenForo bd Api plugin.

  Sources   Download

MIT

The Requires

 

by Florian Schmidt