diff --git a/.travis.yml b/.travis.yml index 2052749a2..2f30e1641 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,15 +1,32 @@ language: php -php: - - '5.4' - - '5.5' - - '5.6' - - '7.0' +jobs: + include: + - php: 5.4 + dist: trusty + - php: 5.5 + dist: trusty + - php: 5.6 + dist: xenial + - php: 7.0 + dist: xenial + - php: 7.1 + dist: xenial + - php: 7.2 + dist: xenial + - php: 7.3 + dist: xenial + - php: 7.4 + dist: xenial + - php: 8.0 + dist: focal + before_script: - phpenv config-add test/resources/php.ini install: - - composer install + - composer install || composer install --ignore-platform-reqs + - if [[ ${TRAVIS_PHP_VERSION:0:1} == "8" ]]; then sh test/resources/compatibility-php8.sh; fi script: - vendor/bin/phing travis @@ -20,4 +37,4 @@ after_script: addons: code_climate: - repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e \ No newline at end of file + repo_token: 5d81d5163c7f9b810b46451042cb0069d24c91a5887466ba774bf89a56f0187e diff --git a/README.md b/README.md index 0be4e82b9..dbabe8384 100644 --- a/README.md +++ b/README.md @@ -11,12 +11,12 @@ # Introduction -PAMI means PHP Asterisk Manager Interface. As its name suggests its just a +PAMI means PHP Asterisk Manager Interface. As its name suggests its a set of php classes that will let you issue commands to an ami and/or receive events, using an observer-listener pattern. -The idea behind this, is to easily implement operator consoles, monitors, etc. -either via SOA or ajax. +The idea behind this, is to easily implement operator consoles, monitors, +real time telephone applications, etc. either via SOA or ajax. A port for nodejs is available at: http://marcelog.github.com/Nami A port for erlang is available at: https://github.com/marcelog/erlami @@ -28,17 +28,24 @@ A port for erlang is available at: https://github.com/marcelog/erlami # PHP Versions +## PHP 5 Note: PAMI Requires PHP 5.3+. PHP versions 5.3.9 and 5.3.10 WILL NOT WORK due to a bug introduced in stream_get_line() in 5.3.9. Please use 5.3.11+ or up to 5.3.8 (see README.PHP-5.3.9-and-5.3.10). +Also running on 5.4 and 5.5. + +## PHP 7 +PHP Versions 7.0, 7.1, 7.2, 7.3 and 7.4 are also confirmed working with +the latest version. + +## PHP 8 +This version is also supported. # Installing Add this library to your [Composer](https://packagist.org/) configuration. In composer.json: -```json - "require": { - "marcelog/pami": "2.*" - } +```sh +composer require marcelog/pami ``` # QuickStart @@ -97,7 +104,8 @@ Also, you might want to look at this article: http://marcelog.github.com/article For an example of using asynchronous AGI with PAMI, see docs/examples/asyncagi -The [march edition](http://sdjournal.org/a-practical-introduction-to-functional-programming-with-php-sdj-issue-released/) of [Software Developer Journal](http://sdjournal.org/) features a complete article about writing telephony applications with PAMI and PAGI. +The [2014 march edition](http://web.archive.org/web/20140625083045/http://sdjournal.org/a-practical-introduction-to-functional-programming-with-php-sdj-issue-released/) +of [Software Developer Journal](http://sdjournal.org/) features a complete article about writing telephony applications with PAMI and PAGI. # Currently Supported Events diff --git a/composer.json b/composer.json index 83e4c798d..411dbf1dd 100644 --- a/composer.json +++ b/composer.json @@ -23,16 +23,16 @@ "psr/log": ">= 1.0.0" }, "require-dev": { - "phpunit/phpunit": "4.*", + "phpunit/phpunit": "4.8.36", "monolog/monolog": "1.*", - "squizlabs/php_codesniffer": "2.*", + "squizlabs/php_codesniffer": "2.*|3.*", "phpdocumentor/phpdocumentor": "2.*", - "phing/phing": "2.*", + "phing/phing": "2.16.3", "phpmd/phpmd": "2.*", "satooshi/php-coveralls": "1.0.1", "evert/phpdoc-md" : "~0.1.1", "codeclimate/php-test-reporter": "dev-master", - "sebastian/phpcpd": "*", + "sebastian/phpcpd": "2.0.4", "marcelog/pagi": "2.*" } } diff --git a/test/actions/Test_Actions.php b/test/actions/Test_Actions.php index 28f9138df..103fd5083 100644 --- a/test/actions/Test_Actions.php +++ b/test/actions/Test_Actions.php @@ -41,7 +41,7 @@ * @license http://marcelog.github.com/ Apache License 2.0 * @link http://marcelog.github.com/ */ -class Test_Actions extends \PHPUnit_Framework_TestCase +class Test_Actions extends \PHPUnit\Framework\TestCase { private $_properties = array(); diff --git a/test/client/Test_Client.php b/test/client/Test_Client.php index feec27b9f..f0bd9ca83 100644 --- a/test/client/Test_Client.php +++ b/test/client/Test_Client.php @@ -189,7 +189,7 @@ function setFgetsMock(array $readValues, $writeValues) * @license http://marcelog.github.com/ Apache License 2.0 * @link http://marcelog.github.com/ */ -class Test_Client extends \PHPUnit_Framework_TestCase +class Test_Client extends \PHPUnit\Framework\TestCase { private $_properties = array(); @@ -256,7 +256,7 @@ public function can_detect_other_peer() 'connect_timeout' => 10, 'read_timeout' => 10 ); - $read = array('Whatever'); + $read = array("Whatever"); $write = array(); setFgetsMock($read, $write); $client = new \PAMI\Client\Impl\ClientImpl($options); diff --git a/test/events/Test_Events.php b/test/events/Test_Events.php index 580fccd13..9c2e95936 100644 --- a/test/events/Test_Events.php +++ b/test/events/Test_Events.php @@ -40,7 +40,7 @@ * @license http://marcelog.github.com/ Apache License 2.0 * @link http://marcelog.github.com/ */ -class Test_Events extends \PHPUnit_Framework_TestCase +class Test_Events extends \PHPUnit\Framework\TestCase { private $_properties = array(); diff --git a/test/resources/compatibility-php8.sh b/test/resources/compatibility-php8.sh new file mode 100644 index 000000000..e7d1e5fb2 --- /dev/null +++ b/test/resources/compatibility-php8.sh @@ -0,0 +1,18 @@ + +#!/bin/sh + +# require new version of phpunit and phpcpd, as the old ones are incompatible with php8 +# (note: cannot generally require the new ones as these are not compatible with php 5) +composer require phpunit/phpunit:8.* sebastian/phpcpd:* --ignore-platform-reqs --with-all-dependencies + +# disable cpd for now, as newer version fails with duplicated code +sed -i 's/, cpd//g' build.xml + +# phpunit compatiblity of new versions (requires return type declaration) +sed -i 's/function setUp()/function setUp() : void/g' test/*/*.php + +# phpunit xml compatiblity, delete deprecated flag +sed -i 's/mapTestClassNameToCoveredClassName="false"//g' test/resources/phpunit.xml + +# phpunit disable stop on risky, as risky test functions are being used +sed -i 's/stopOnRisky="true"//g' test/resources/phpunit.xml diff --git a/test/resources/php.ini b/test/resources/php.ini index 2e67c2995..125753398 100644 --- a/test/resources/php.ini +++ b/test/resources/php.ini @@ -1 +1,2 @@ -date.timezone = "UTC" \ No newline at end of file +date.timezone = "UTC" +xdebug.mode = "coverage"