Download the PHP package shrimpwagon/digium-switchvox-api without Composer
On this page you can find all versions of the php package shrimpwagon/digium-switchvox-api. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download shrimpwagon/digium-switchvox-api
More information about shrimpwagon/digium-switchvox-api
Files in shrimpwagon/digium-switchvox-api
Package digium-switchvox-api
Short Description PHP wrapper for Switchvox API
License MIT
Homepage http://github.com/shrimpwagon/digium-switchvox-api
Informations about the package digium-switchvox-api
Digium Switchvox API
PHP wrapper for the Digium Switchvox API.
Features
This makes simple Switchvox's requests in JSON or XML.
Digium's PHP client library requires a PEAR and PECL package whereas this implementation does not require them.
Usage
$client = new Switchvox\SwitchvoxClient();
$client->user = 'admin';
$client->password = '1234';
$client->uri = 'https://somedigiumendpoint.com';
// By default it will not care if the SSL cert is valid, to change:
$client->strict_ssl = true;
// Timeout in seconds, default is 10 seconds
$client->timeout = 15;
// If JSON is preferred (default):
$client->data_type = 'json';
// If XML is preferred:
$client->data_type = 'xml';
// Request a method with parameters
$params = [
'sort_field' => 'number',
'sort_order' => 'ASC',
'items_per_page' => '9999',
'page_number' => '1'
];
$response = $client->send('switchvox.directories.getExtensionList', $params);
// Request without parameters
$response = $client->send('switchvox.directories.getInfo');
Notes
The strict_ssl
feature correlates to the Httpful\Request timeout.
All Digium Switchvox web service methods can be found here.
The send
method returns a Httpful\Response object.
Testing
To run tests in phpunit you must use your own environment variables for user and password:
$ SWITCHVOX_USER=<user> SWITCHVOX_PASSWORD=<password> phpunit -v --debug
For development you can get a free demo Digium Switchbox account.
They will send you a user name and passowrd to your email address.
Once you log into the admin portal take note of the domain name and use that as the uri.
The uri
property for this client and the phpunit.xml file is pre-populated with:
https://switchvoxdemo1.digiumcloud.net
Requirements
- PHP >= 5.4
- XMLWriter, if using XML, bundled and enabled as of PHP 5.1.2
Installation
Composer
Digium Switchvox API is PSR-0 compliant and can be installed using composer. Simply add shrimpwagon/digium-switchvox-api
to your composer.json file. Composer is the sane alternative to PEAR. It is excellent for managing dependencies in larger projects.
{
"require": {
"shrimpwagon/digium-switchvox-api": "*"
}
}
Contributing
Digium Switchvox API highly encourages sending in pull requests. When submitting a pull request please:
- All pull requests should target the
dev
branch (notmaster
) - Make sure your code follows the coding conventions
- Please use soft tabs (four spaces) instead of hard tabs
- Make sure you add appropriate test coverage for your changes
- Run all unit tests in the test directory via
phpunit ./tests
- Include commenting where appropriate and add a descriptive pull request message
Changelog
1.0.0
- Basic funcationality to call API methods with XML or JSON