Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 2.29 KB

README.md

File metadata and controls

99 lines (73 loc) · 2.29 KB

CML Provisioning SDK for PHP (v1)

This repository contains the open source PHP SDK that allows you to access the CML Provisioning API from your PHP app.

Usage

Note: This version of the CML Provisioning SDK for PHP requires PHP 5.4 or greater.

  1. 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";
}
  1. 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";
}
  1. 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.

License

Please see the license file for more information.

Security Vulnerabilities

If you have found a security issue, please contact the maintainers directly at [email protected].