2017 © Pedro Peláez
 

library ue-php-sdk

UnificationEngine PHP SDK

image

unificationengine/ue-php-sdk

UnificationEngine PHP SDK

  • Tuesday, June 20, 2017
  • by daedlock
  • Repository
  • 12 Watchers
  • 1 Stars
  • 107 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 5 Versions
  • 0 % Grown

The README.md

ue-php-sdk

A UnificationEngine client SDK for PHP, (*1)

Installation Using Composer/Packagist

$ composer require unificationengine/ue-php-sdk

Usage

use UnificationEngine\Models\UEApp;
$app = new UEApp("APP_KEY","APP_SECRET");

Creating User

use UnificationEngine\Models\UEApp;
use UnificationEngine\Models\UEUser;

//Use our app
$app = new UEApp("APP_KEY","APP_SECRET");

//Creating a new user
$user = $app->create_user();

//Using existing user using key and secret
$user = new UEUser("USER_KEY","USER_SECRET");

//Using existing user using it's uri
$user = new UEUser("user://USER_KEY:USER_SECRET@");


Listing Users

$users = $app->list_users();

note: listed users does not have the user_secret listed for security reasons. So, you cant use a user from the list unless you have saved it's key somewhere, (*2)

Deleting User

$user = $app->create_user();
$app->delete_user($user) //true

Adding a connection to a user

$connection = $user->add_connection("connection_name", "service", "service_access_token", $optional_params);
//connection is an instance of UEConnection
  • connection_name must be unique per connection.
  • service must be the scheme of the connector from the developer portal
  • service_access_token has to be valid and working from the provider side
  • $optional_params should be an array with "key", "value" pair

Listing User connections

$connections = $user->list_connections()
// connections is an array of UEConnection objects

Removing a User Connection

$user->remove_connection($connection_name) //true | false

Testing a connection

//return true if working, false otherwise
$user->test_connection($service_url) //eg: facebook://accesstoken@facebook.com

Sending a message using a connection

```php, (*3)

$app = new UEApp("APP_KEY","APP_SECRET");, (*4)

//Create a new user $user = $app->create_user();, (*5)

//Or use an existing user $user = new UEUser("USER_KEY","USER_SECRET");, (*6)

//Add a connection. (throws an error if the connection is not added) $connection = $user->add_connection("FB","facebook","FACEBOOK_ACCESS_TOKEN"); // | | // Connection Name ------------------+ | // Connector Scheme -------------------------+, (*7)

//Message Options $options = array( "receivers" => array( array( "name"=>"Page", "id"=>"283031198486599" ), array( "name"=> "Me" ) ), "message"=>array( "subject"=>"test", "body"=> "ABC", "image"=>"http://politibits.blogs.tuscaloosanews.com/files/2010/07/sanford_big_dummy_navy_shirt.jpg", "link"=>array( "uri"=> "http://google.com", "description"=> "link desc", "title"=>"link title" ) ) );, (*8)

//Send the message and get their uris $uris = $connection->send_message($options);, (*9)

print_r($uris);, (*10)

The Versions

20/06 2017

dev-master

9999999-dev

UnificationEngine PHP SDK

  Sources   Download

The Requires

 

by Hossam Saraya

26/03 2016

1.5.1

1.5.1.0

UnificationEngine PHP SDK

  Sources   Download

The Requires

 

by Hossam Saraya

13/03 2016

1.4.0

1.4.0.0

UnificationEngine PHP SDK

  Sources   Download

The Requires

 

by Hossam Saraya

13/03 2016

1.1.0

1.1.0.0

UnificationEngine PHP SDK

  Sources   Download

The Requires

 

by Hossam Saraya

13/03 2016

1.0.0

1.0.0.0

UnificationEngine PHP SDK

  Sources   Download

The Requires

 

by Hossam Saraya