singly / singly
A PHP library for the Singly API
Requires
- php: >=5.3.3
- zendframework/zendframework: >=2.0.0,!=2.0.6
This package is auto-updated.
Last update: 2024-04-11 13:38:17 UTC
README
This library abstracts the Singly API to PHP service object.
Example
An example application is included on the example
branch. See the README.md in that branch for details.
Installation
-
edit
composer.json
file with following contents:"require": { "singly/singly": "dev-master" }
-
install composer via
curl -s http://getcomposer.org/installer | php
(on windows, download http://getcomposer.org/installer and execute it with PHP) -
run
php composer.phar install
Use
Create the Singly service
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.
Singly::deleteService('facebook');
De-authorize all services. This will delete a user's profile.
Singly::deleteAll();
Get an access token in a redirectUri / callback handler. Getting an access token with code sets to access token too.
$code = $_GET['code']; Singly::getAccessToken($code);
API Services
// 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());