This repository contains the open source PHP SDK that allows you to access the CML Provisioning API from your PHP app.
Note: This version of the CML Provisioning SDK for PHP requires PHP 5.4 or greater.
- Get All Accounts
$partnerId = $argv[1];
$apiKey = $argv[2];
$apiClient = new ApiClient($partnerId, $apiKey);
try {
//setup query params
$params = array(
"start" => "1",
"limit" => "2",
"query" => "acme",
"sortBy" => "startDate",
"sortDirection" => "desc",
"filter" => "active"
);
$result = $apiClient->get("/accounts", $params);
print_r ($result);
}
catch (Exception $e) {
echo "Caught exception: ", $e->getMessage(), "\n";
}
- Get Single Account.
$partnerId = $argv[1];
$apiKey = $argv[2];
$accountId = $argv[3];
$apiClient = new ApiClient($partnerId, $apiKey);
try {
$result = $apiClient->get("/account/" . $accountId, null);
print_r ($result);
}
catch (Exception $e) {
echo "Caught exception: ", $e->getMessage(), "\n";
}
- Create Account.
$partnerId = $argv[1];
$apiKey = $argv[2];
//Declare Variables tp create new an account
$name = "ACME Inc";
$firstName = "Road";
$lastName = "Runner";
$email = "[email protected]";
$passwd = "TheSuperSecret";
$trialDays = 1;
//Create new Account Object
$objAccount = new Account($name, $firstName, $lastName, $email, $passwd, $trialDays);
//Add website add-on
$objAccount->addWebsiteAddon();
//Remove website add-on
//$objAccount->removeWebsiteAddon();
$apiClient = new ApiClient($partnerId, $apiKey);
try {
$result = $apiClient->post("/account", $objAccount);
//Print Result
print_r ($result);
}
catch (Exception $e) {
echo "Caught exception: ", $e->getMessage(), "\n";
}
All other examples are available here.
Complete documentation and examples are available here.
Please see the license file for more information.
If you have found a security issue, please contact the maintainers directly at [email protected].