Download the PHP package siliconstraits/cems-php-sdk without Composer
On this page you can find all versions of the php package siliconstraits/cems-php-sdk. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download siliconstraits/cems-php-sdk
More information about siliconstraits/cems-php-sdk
Files in siliconstraits/cems-php-sdk
Package cems-php-sdk
Short Description PHP SDK for SSS CEMS platform
License MIT
Homepage https://github.com/siliconstraits/cems-php-sdk
Informations about the package cems-php-sdk
cems-php-sdk
This is the official PHP-SDK for CEMS's API. View api documentation and examples.
Build Status
Installation
Requirements
- PHP >= 5.3.2
- PHP curl extensions.
You don't need to clone the repo directly to use this SDK, the entire library and its dependencies can be installed through Composer ( https://getcomposer.org/doc/00-intro.md ).
-
First, install Composer if you haven't had it already
-
Create
composer.json
and add the following -
Install
cems-php-sdk
package via Composer -
Include the library in your script
- See below for how to configure your Client class.
Configuration
All CEMS API requests can be made using the CEMS\Client
class. This class must be initialized with your authentication details such as an API key (preferred), email/password combo. Remember to declare the API URL from CEMS service for proper connection to your own server.
API key Config
Email/Password Config
Your app users are almost ready to start signing! See below for the most common use cases for this wrapper.
Usage
Create a RESTful Request
You can create a RESTful request by using one of following method from an instance of Client class:
For example:
NOTE: You must provide the right path from API documentation. NOTE2: For the compatibility problem of Guzzle between PHP 5.3 and 5.4, and Composer still not support multiple package version with correspond PHP environment, we assure you that the local test has been passed before release each iterative version.
The request will automatically return a Response object contain JSON data return from API if success. Then you can retrieve the proper result by using the method getObject($type='CEMS\Resource')
or getObjectList($type='CEMS\Resource')
Retrieving fields returned from the API
Using magic methods to set or get fields
Or if you want to get all attributes in an array
Testing
This project contains PHPUnit tests that check the SDK code and can also be referenced for examples. Most are functional and integrated tests that walk through real user scenarios. In some cases, this means you must have an active network connection with access to CEMS system to execute all tests.
To run the tests
- Copy file
phpunit.xml.sample
tophpunit.xml
- Edit the new file, uncomment and enter your
API_KEY
,CLIENT_ID
,CLIENT_SECRET
andCALLBACK_URL
- Make sure your account has at least 1 template
- Run
./vendor/bin/phpunit