|
1 |
| -# php-sipwise-api |
2 |
| -Sipwise Api client library |
| 1 | +# PHP Sipwise API |
| 2 | + |
| 3 | +[](https://travis-ci.org/nophaa/php-sipwise-api) |
| 4 | +[](https://styleci.io/repos/153237868) |
| 5 | +[](https://packagist.org/packages/nophaa/php-sipwise-api) |
| 6 | +[](https://packagist.org/packages/nophaa/php-sipwise-api) |
| 7 | +[](https://packagist.org/packages/nophaa/php-sipwise-api) |
| 8 | +[](https://packagist.org/packages/nophaa/php-sipwise-api) |
| 9 | +[](https://packagist.org/packages/nophaa/php-sipwise-api) |
| 10 | + |
| 11 | +A simple Object Oriented wrapper for Sipwise Server API, written with PHP. |
| 12 | + |
| 13 | +Tested with Sipwise version mr6.4.1, and for testing you can use vagrant file include in the repo. For more information about sipwise server you can go to http://sipwise.com. |
| 14 | + |
| 15 | +## Requirements |
| 16 | + |
| 17 | +* PHP >= 5.6 |
| 18 | +* A [HTTP client](https://packagist.org/providers/php-http/client-implementation) |
| 19 | +* A [PSR-7 implementation](https://packagist.org/providers/psr/http-message-implementation) |
| 20 | +* A Guzzle http client for custom http client |
| 21 | +* (optional) PHPUnit to run tests. |
| 22 | + |
| 23 | +## Install |
| 24 | + |
| 25 | +Via Composer: |
| 26 | + |
| 27 | +```bash |
| 28 | +$ composer require nophaa/php-sipwise-api php-http/guzzle6-adapter |
| 29 | +``` |
| 30 | + |
| 31 | +Why `php-http/guzzle6-adapter`? We are decoupled from any HTTP messaging client with help by [HTTPlug](http://httplug.io/). Read about clients in our [docs](doc/customize.md). |
| 32 | + |
| 33 | +## Basic usage of `php-sipwise-api` client |
| 34 | + |
| 35 | +```php |
| 36 | +<?php |
| 37 | + |
| 38 | +// This file is generated by Composer |
| 39 | +require_once __DIR__ . '/vendor/autoload.php'; |
| 40 | + |
| 41 | +$client = new \Sipwise\Client(); |
| 42 | +$adapter = Http\Adapter\Guzzle6\Client::createWithConfig(['verify'=>false]); |
| 43 | +$apiClient = Sipwise\Client::createWithHttpClient($adapter); |
| 44 | +$apiClient->authenticate('username','password'); |
| 45 | +$apiClient->setUrl('https://127.0.0.1:1443'); |
| 46 | +$apiClient->api('subscriber')->all(['username' => xxx]); |
| 47 | +``` |
| 48 | +From `$apiClient` object, you can access sipwise api. |
| 49 | + |
| 50 | +## Using Sipwise Vagrant |
| 51 | +using Vagrant file you can run sipwise server |
| 52 | + |
| 53 | +```bash |
| 54 | +$ vagrant up |
| 55 | +``` |
| 56 | +to remote the server |
| 57 | + |
| 58 | +```bash |
| 59 | +vagrant ssh |
| 60 | +``` |
| 61 | + |
| 62 | +shutdown sipwise vagrant server |
| 63 | + |
| 64 | +```bash |
| 65 | +vagrant halt |
| 66 | +``` |
| 67 | + |
| 68 | +sipwise api by default run in port 1443 |
| 69 | + |
| 70 | +## License |
| 71 | + |
| 72 | +`php-sipwise-api` is licensed under the MIT License - see the LICENSE file for details |
| 73 | + |
0 commit comments