dev-master
9999999-dev http://singly.comA PHP library for the Singly API
MIT
The Requires
- php >=5.3.3
- zendframework/zendframework >=2.0.0,!=2.0.6
by Tom Anderson
php singly
A PHP library for the Singly API
This library abstracts the Singly API to PHP service object., (*1)
An example application is included on the example
branch. See the README.md in that branch for details., (*2)
edit composer.json
file with following contents:, (*3)
json
"require": {
"singly/singly": "dev-master"
}
, (*4)
curl -s http://getcomposer.org/installer | php
(on windows, download
http://getcomposer.org/installer and execute it with PHP)php composer.phar install
Create the Singly service, (*5)
use \Singly\Service\Singly; Singly::configure($clientId, $clientSecret, $redirectUri); Singly::setAccessToken('access_token'); // Get a login url to authorize a service $loginUrl = Singly::getLoginUrl('facebook');
De-authorize a service. This will un-link a service from the user's profile., (*6)
Singly::deleteService('facebook');
De-authorize all services. This will delete a user's profile., (*7)
Singly::deleteAll();
Get an access token in a redirectUri / callback handler. Getting an access token with code sets to access token too., (*8)
$code = $_GET['code']; Singly::getAccessToken($code);
API Services, (*9)
// Get Login URL Singly::getLoginUrl($service, $parameters = array()); // Valid options: access_token, scope, flag // Simple Unified Profile Singly::getProfile($access_token = null); // Profiles Singly::getProfiles($service = null, $parameters = array()); // Services Singly::getServices($service = null, $endpoint = null, $parameters = array()); // Types Singly::getTypes($type = null, $parameters = array()); // Post to Types // https://singly.com/docs/sharing Singly::postTypes($type, $parameters = array()); // Global Items Singly::getById($id); // Proxy to Service API Singly::getProxy($service, $path, $parameters = array()) // By URL Singly::getByUrl($url, $parameters = array()); // By Contact ID Singly::getByContact($service, $id, $parameters = array()); // Friends // https://singly.com/docs/friends Singly::getFriends($service = null, $parameters = array());
A PHP library for the Singly API
MIT
php singly