Download the PHP package greenfieldtech-nirs/phpari without Composer
On this page you can find all versions of the php package greenfieldtech-nirs/phpari. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download greenfieldtech-nirs/phpari
More information about greenfieldtech-nirs/phpari
Files in greenfieldtech-nirs/phpari
Package phpari
Short Description A PHP Class Library for Asterisk ARI
License GPL-2.0
Homepage https://github.com/greenfieldtech-nirs/phpari
Rated 5.00 based on 2 reviews
Informations about the package phpari
phpari
A Class Library enabling Asterisk ARI functionality for PHP
Dependencies
These are the minimum requirements to have phpari installed on your server:
** PHP >= 5.3.9
** Composer
** PHP OpenSSL Module to connect using SSL (wss:// uris)
Additional dependencies are installed via Composer, these include:
** Reactphp (http://reactphp.org/)
** ZF2 Logger (http://framework.zend.com/manual/2.0/en/modules/zend.log.overview.html)
Installation
The recommended method of installation is using Composer. Add the following to your composer.json file:
We recommend using the "dev-master" version at this point in time, as we are still under heavy development and testing.
Configuring phpari.ini
The phpari.ini file is our primary configuration file. You can define your own, just make sure to initiate your phpari object correctly. The files' contents is as following:
As you may notice, we already carry an Asterisk Manager configuration in there - this will be used in the future to provide an Asterisk manager connector object as well.
Verify functionality
The simplest way to verify that phpari is installed correctly is by using it. Here is a minimal script to ensure you every installed correctly:
The output should resemble the following:
Error Handling within PHPARI
In order to allow for better error handling, we've decided to hold two variables, within the initiated phpari object. These are "lasterror" and "lasttrace". When an error occures, in any of the phpari module requests, be it a PEST error or another, an exception is thrown internally. In order not to break your applications, we will return a FALSE value, while populating the "lasterror" and "lasttrace" variables.
For example:
In the above case, we try to issue an "applications" GET request over to our Asterisk server. In case of an error, the applications object will return a FALSE value, while populating the "lasterror" and "lasttrace" variables. Here is a sample output, for a case where the "port" configuration is wrong, in phpari.ini:
Basic Stasis application programming
Stasis is an event driven environment, which isn't really the native environment for PHP. However, thanks to PHP 5.3 and the React library, it is possible to write a "callback" based web socket client. The following example shows how this can be done - the complete example is under examples/BasicStasisApplication.php.
First, we need to setup our basic Stasis connection to Asterisk:
Note this, the constructor will normally return no errors for this stage, as we are mearly building the required objects, not connecting to Asterisk yet. Now, we need to define our Stasis Connection Handler:
Note that we will be ommiting an Event for any additional Asterisk Stasis "message" that is received. Now, we need to actually build our connection to Asterisk:
Our main script body would be the following:
That's it - this is your most basic Stasis application. We suggest that you now take a look at examples/BasicStasisApplication.php to see the entire code in action.
Reporting Issues
Please report issues directly via the Github project page.
Contibuting Code
We are very open when it comes to people contributing code to this project. In order to make life easier, here is the preferred method to contribute code:
For bug fixes and security updates in Master branch:
- Fork the Master Branch into your own personal Github account
- Update your local fork
- Generate a pull request from your own fork over to our Master Branch
For new features and improvement:
- Fork the Development Branch into your own personal Github account
- Update your local fork
- Generate a pull request from your own fork over to our development branch
We will do our best to go over the various contributions as fast as possible. Bug fixes and security updates will be handled faster - feature improvements will be added to the next major release.
Our IDE of choice is phpStorm from JetBrains (http://www.jetbrains.com/phpstorm/) - we use the default styling, so no need to change that. If you use a different IDE, please make sure you update your IDE to support the internal styling of the project, so that you don't break the general code styling.
Make sure to document your code - once it's merged in, we will need to keep working on your code, so please make sure your documentation will be clear and concise, so we can continue your work (as required).
Our objective is to involve the community as much as possible, so feel free to jump in and assist. Contibutions to the project will automatically put your name into the README.md file, so that everybody will see your coolness and greatness supporting the Open Source movement and the continuation of this project.
Release Policy
Releasing code into the Open Source is always a challenge, it can be both confusing and dawnting at the same time. In order to make life simple with version numbers, here is our projected release policy (it may change in the future).
Every version will be marked with a Major.Minor.Patch version numbering scheme.
A major release will be released once the code of the library is stable and battle tested. How long does that take? good question, we don't know. Currently, our major release version is 0 - we are still in active development.
A minor release will be released once the code of the library is stable and had been introduced with a significant number of fixes and modifications, and been regressed by several members of the community.
A patch release will be released once the code of the library is stable and had been introduced with minor modifications. These modifications will normally include bug fixes and security updates.
Feature enhancements will only be merged into minor releases, not into patch releases.
Team Members and Contributors
The following list includes names and aliases for people who had something to do with the creation/maintenance of this library. It takes alot of resources to maintain an Open Source project, thus, we will always do our best to make sure contributions and tested and merged as fast as possible.
Nir Simionovich, https://github.com/greenfieldtech-nirs
Leonid Notik, https://github.com/lnotik
Scott Griepentrog, https://github.com/stgnet
Matak, https://github.com/matak