2017 © Pedro Peláez
 

library php-sdk

Monscierge API bindings for PHP.

image

monscierge/php-sdk

Monscierge API bindings for PHP.

  • Thursday, November 26, 2015
  • by monscierge
  • Repository
  • 10 Watchers
  • 1 Stars
  • 21 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Monscierge PHP SDK

A PHP wrapper for the Monscierge API. Create an application to get your client credentials in order to authenticate into the API., (*1)

Installation

Simply add the following to your composer.json require block:, (*2)

'monscierge/php-sdk'

Examples

Authentication

All API methods require you be authenticated with a client that is registered with Monscierge. You will then use these credentials to instantiate your client instance., (*3)

$client = new \Monscierge\Client($client_id, $client_secret);

Client Authenticated Requests

You can exchange your client credentials for an OAuth token to use for any non-user authenticated APIs., (*4)

$oauth_token = $client->clientCredentialsExchange('uber4cats', 'nom0res3crets');

User Authenticated Requests

For methods that require user permission to alter context, you will need to either use OAuth flow and redirect the user to the authorization URL which will upon granting permission with the scopes requested allow access as the user., (*5)

$authorize_url = $client->authorizeUrl('http://example.app/monscierge/callback');

Alternatively, you can ask the user for their login credentials to be exchanged for an OAuth token, but this is generally not recommended., (*6)

$oauth_token = $client->basicCredentialsExchange('johnny.appleseed@monscierge.com', '123456');

Using OAuth tokens

Once you have an OAuth token, to then make API calls you should set the access token on the client instance., (*7)

$client->setAccessToken($oauth_token['access_token']);

You will also want to store the refresh_token in order to prevent sessions from timing out for your users of your application. When a token expires, you can exchange it for a new OAuth token to continue making API calls., (*8)

$client->refreshTokenExchange($oauth_token['refresh_token']);

Search places

$client->places('San Francisco');

Get list of requests for a user

$client->userRequests();

For more examples, dive into the SDK clients and look at the methods signatures. If you have any questions or feedback create an issue or send us an email., (*9)

The Versions

26/11 2015

dev-master

9999999-dev http://github.com/monscierge/php-sdk

Monscierge API bindings for PHP.

  Sources   Download

MIT

The Requires

 

hotels monscierge monscierge api hospitality

26/11 2015

v0.1.0

0.1.0.0 http://github.com/monscierge/php-sdk

Monscierge API bindings for PHP.

  Sources   Download

MIT

The Requires

 

hotels monscierge monscierge api hospitality

26/11 2015

v0.1.1

0.1.1.0 http://github.com/monscierge/php-sdk

Monscierge API bindings for PHP.

  Sources   Download

MIT

The Requires

 

hotels monscierge monscierge api hospitality