Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
A Zend Framework 2 module for Singly auth and API querying
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
config
src/Singly
view/singly/singly
LICENSE
README.md
composer.json

README.md

ZF2 Singly Module

The Singly module provides authentication against any of singly.com's providers and API access through a service object.

Singly documentation may be found at https://singly.com/docs

Installation

Installation steps

  1. begin with a Zend Framework 2 skeleton application
  2. edit the composer.json file with following contents:

     "require": {
         "singly/singly-zf2-module": "dev-master"
     }
  3. install composer via curl -s http://getcomposer.org/installer | php (on windows, download http://getcomposer.org/installer and execute it with PHP)
  4. run php composer.phar install
  5. open my/project/directory/configs/application.config.php and add following keys to your modules

     'Singly',
  6. drop vendor/singly/singly-zf2-module/config/module.singly.local.php.dist into your application's config/autoload directory, rename it to module.singly.local.php and make the appropriate changes.

Authentication

http://localhost/singly/login Show the available services from Singly to login

http://localhost/singly Show the authenticated user

http://localhost/singly/logout End the authentication session

Usage

Once a user is authenticated with the Zend\Authentication\Adapter\Singly adapter service you may use the Singly service object to interact with the API

// Init service object
$singly = $this->getServiceLocator()->get('serviceSingly');

// Get singly identity 
$id = $singly->getIdentity();

// Get a login url 
$url = $singly->getLoginUrl($serviceName);

API Services through Singly

// Profiles
$singly->getProfiles($service = null, $parameters = null);

// Services
$singly->getServices($service = null, $endpoint = null, $parameters = array());

// Types
$singly->getTypes($type = null, $parameters = null);

// Global Items
$singly->getById($id);

// Proxy to Service API
$singly->getProxy($service, $path, $parameters = null)

// By URL
$singly->getByUrl($url, $parameters = null);

// By Contact ID
$singly->getByContact($service, $id, $parameters = null);

A view helper object is also provided which returns the Singly service object

// Within a view
$singly = $this->singly();

Example Application

An example application is included on the example branch. See the README.md in that branch for details.

The example application provides an important bifrication of the Singly namespace by integrating the library with Zend Framework and providing a view layer of Controllers and views. The author recommends you use this branch to start any new Sinlgy project.

Something went wrong with that request. Please try again.