PHPackages                             cloudonix/cloudonix-php - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. cloudonix/cloudonix-php

ActiveLibrary[API Development](/categories/api)

cloudonix/cloudonix-php
=======================

PHP Class Library for interacting with Cloudonix APIs and Voice Developer APIs

0683PHP

Since Jul 9Pushed 6y ago1 watchersCompare

[ Source](https://github.com/cloudonix/cloudonix-php)[ Packagist](https://packagist.org/packages/cloudonix/cloudonix-php)[ RSS](/packages/cloudonix-cloudonix-php/feed)WikiDiscussions master Synced 6d ago

READMEChangelog (1)DependenciesVersions (3)Used By (0)

cloudonix-php
=============

[](#cloudonix-php)

What is this about?
-------------------

[](#what-is-this-about)

Cloudonix is not your typical communications platform, it is a Communications Infrastructure as a Service platform. As such, it exposes a comprehensive command and control API, allowing developers to directly interact with the Cloudonix internal datamodels. These datamodels are the primary building blocks of the Cloudonix framework - and are the core of working with the platform.

The `cloudonix-php` library provides a rapid development framework for PHP developers, to rapidly interact with the command and control API - and in accordance to the Cloudonix datamodels security paradigms.

Installation
------------

[](#installation)

You can install **cloudonix-php** via composer or by downloading the source.

#### Via Composer:

[](#via-composer)

**cloudonix-php** is available on Packagist as the [`cloudonix/cloudonix-php`](http://packagist.org/packages/cloudonix/cloudonix-php) package:

```
composer require cloudonix/cloudonix-php @dev

```

Quickstart
----------

[](#quickstart)

### before anything else

[](#before-anything-else)

Before issuing any `primitive` (as describer below), the `->getSelf()` method MUST be called. This method will both validate your API key credentials and populate the required tenant information for continued operations.

### cloudonix-php primitives

[](#cloudonix-php-primitives)

The library consists of several key `primitives` that are used across the entire library, these are:

- Primary data model primitives (applicable to `tenant`, `domain`, `subscriber`, `application`, `dnid` and `trunk` )
    - `create` - Create a data model object.
    - `delete` - Delete a data model object.
    - `update` - Update a data model object.
    - `get` - Get a data model object.
- Secondary data model primitives (these normally apply to API keys, created for a specific data model object)
    - `createApikey` - Create an API key, associated with a specific data model object.
    - `deleteApikey` - Delete an API key, associated with a specific data model object.
    - `updateApikey` - Update an API key, associated with a specific data model object.
    - `getApikeys` - Get a list of API keys, associated with a specific data model object.
- Special data model primitives
    - Special `domain` primitives
        - `createAlias` - Create a domain alias for a specific domain data model object.
        - `deleteAlias` - Delete a domain alias for a specific domain data model object.
        - `listAliases` - List the aliases for a specific domain data model object.

Primitives are invoked by declaring the primitive intention (eg. `->create()`), followed by a set of `setX` and/or `byX`rules. For example:

```
$myNewDomain = $myCloudonixClient->domains()  // Invoke the `domains` data model
	->create()                                // Invoke the `create` primitive
	->setName('my-domain.com')                // Set the new domain name to 'my-domain.com'
	->setActive(true)                         // Set the new domain status to `active`
	->setDomainAlias('my-domain-alias.com')   // Set the new domain with an alias of 'my-domain-alias.com'
	->setCallTimeout(30)                      // Set the global domain ringing timeout to 30 seconds
	->setUnknownToBorderCalls(false)          // Set routing of unknown DNID to the border gateway
	->run();                                  // Execute the creation transaction
```

Each primitive ensures that invoking it will always be performed using a minimal set of rules. If the rules are not met, the library will automatically generate an Exception. We recommend examining the library documentation, available [here](http://webinc.cloudonix.io/php-cloudonix/index.html).

### Create a new domain in your tenant account

[](#create-a-new-domain-in-your-tenant-account)

```
// Connect to the Cloudonix platform and Create a new domain in your tenant account
