A UnificationEngine client SDK for PHP
$ composer require unificationengine/ue-php-sdk
use UnificationEngine\Models\UEApp;
$app = new UEApp("APP_KEY","APP_SECRET");
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@");
$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
$user = $app->create_user();
$app->delete_user($user) //true
$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 portalservice_access_token
has to be valid and working from the provider side$optional_params
should be an array with "key", "value" pair
$connections = $user->list_connections()
// connections is an array of UEConnection objects
$user->remove_connection($connection_name) //true | false
//return true if working, false otherwise
$user->test_connection($service_url) //eg: facebook://[email protected]
$app = new UEApp("APP_KEY","APP_SECRET");
//Create a new user
$user = $app->create_user();
//Or use an existing user
$user = new UEUser("USER_KEY","USER_SECRET");
//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 -------------------------+
//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"
)
)
);
//Send the message and get their uris
$uris = $connection->send_message($options);
print_r($uris);