diff --git a/.gitignore b/.gitignore index 2da45a7..26101ef 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ /vendor -.idea \ No newline at end of file +.idea +composer.phar \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..9696429 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + +## 1.0.0 (2022-07-28) + +A major new feature release, see [**release announcement**](https://clue.engineering/2021/announcing-reactphp-default-loop). + +* support php ^8.0 (and drop support older versions) + +* Update library dependencies for major versions + diff --git a/composer.json b/composer.json index 78628b3..1796171 100644 --- a/composer.json +++ b/composer.json @@ -1,20 +1,31 @@ { - "name": "clearvox/react-ami", - "description": "A ReactPHP implementation of communicating with the Asterisk Manager Interface", - "keywords": ["AMI", "Asterisk Manager Interface", "ReactPHP"], - "license": "MIT", - "authors": [ - { - "name": "Leon Rowland", - "email": "leon@rowland.nl" - } - ], - "require": { - "php": ">=5.3", - "react/socket-client": "0.4", - "illuminate/contracts": "~5.1" + "name": "clearvox/react-ami", + "description": "A ReactPHP implementation of communicating with the Asterisk Manager Interface", + "keywords": [ + "AMI", + "Asterisk Manager Interface", + "ReactPHP" + ], + "license": "MIT", + "authors": [ + { + "name": "Leon Rowland", + "email": "leon@rowland.nl" }, - "autoload": { - "psr-0": { "Clearvox\\Asterisk\\AMI": "src/" } + { + "name": "Rui Pedrosa", + "email": "rui.pedrosa@x2com.nl" } -} + ], + "require": { + "php": "^8.0", + "react/socket": "^1.11", + "react/stream": "^1.2", + "illuminate/contracts": "^6.0" + }, + "autoload": { + "psr-4": { + "Clearvox\\Asterisk\\AMI\\": "src/Clearvox/Asterisk/AMI" + } + } +} \ No newline at end of file diff --git a/composer.lock b/composer.lock index e7bf925..5e97844 100644 --- a/composer.lock +++ b/composer.lock @@ -1,34 +1,32 @@ { "_readme": [ "This file locks the dependencies of your project to a known state", - "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "hash": "4d70f5b1cb8b798e8d542f7a221e4bff", + "content-hash": "463fa2a8ba9b8ed89edd3b8a1e91f66e", "packages": [ { "name": "evenement/evenement", - "version": "v2.0.0", + "version": "v3.0.1", "source": { "type": "git", "url": "https://github.com/igorw/evenement.git", - "reference": "f6e843799fd4f4184d54d8fc7b5b3551c9fa803e" + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/igorw/evenement/zipball/f6e843799fd4f4184d54d8fc7b5b3551c9fa803e", - "reference": "f6e843799fd4f4184d54d8fc7b5b3551c9fa803e", + "url": "https://api.github.com/repos/igorw/evenement/zipball/531bfb9d15f8aa57454f5f0285b18bec903b8fb7", + "reference": "531bfb9d15f8aa57454f5f0285b18bec903b8fb7", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=7.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } + "require-dev": { + "phpunit/phpunit": "^6.0" }, + "type": "library", "autoload": { "psr-0": { "Evenement": "src" @@ -41,8 +39,7 @@ "authors": [ { "name": "Igor Wiedler", - "email": "igor@wiedler.ch", - "homepage": "http://wiedler.ch/igor/" + "email": "igor@wiedler.ch" } ], "description": "Événement is a very simple event dispatching library for PHP", @@ -50,29 +47,35 @@ "event-dispatcher", "event-emitter" ], - "time": "2012-11-02 14:49:47" + "support": { + "issues": "https://github.com/igorw/evenement/issues", + "source": "https://github.com/igorw/evenement/tree/master" + }, + "time": "2017-07-23T21:35:13+00:00" }, { "name": "illuminate/contracts", - "version": "v5.0.0", + "version": "v6.20.44", "source": { "type": "git", "url": "https://github.com/illuminate/contracts.git", - "reference": "78f1dba092d5fcb6d3a19537662abe31c4d128fd" + "reference": "2aeb1ea8985f7a79abaf7186234c94b543a04165" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/illuminate/contracts/zipball/78f1dba092d5fcb6d3a19537662abe31c4d128fd", - "reference": "78f1dba092d5fcb6d3a19537662abe31c4d128fd", + "url": "https://api.github.com/repos/illuminate/contracts/zipball/2aeb1ea8985f7a79abaf7186234c94b543a04165", + "reference": "2aeb1ea8985f7a79abaf7186234c94b543a04165", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": "^7.2.5|^8.0", + "psr/container": "^1.0", + "psr/simple-cache": "^1.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.0-dev" + "dev-master": "6.x-dev" } }, "autoload": { @@ -87,309 +90,566 @@ "authors": [ { "name": "Taylor Otwell", - "email": "taylorotwell@gmail.com" + "email": "taylor@laravel.com" } ], "description": "The Illuminate Contracts package.", - "time": "2015-01-30 16:27:08" + "homepage": "https://laravel.com", + "support": { + "issues": "https://github.com/laravel/framework/issues", + "source": "https://github.com/laravel/framework" + }, + "time": "2021-12-01T12:53:22+00:00" }, { - "name": "react/cache", - "version": "v0.4.0", + "name": "psr/container", + "version": "1.1.2", "source": { "type": "git", - "url": "https://github.com/reactphp/cache.git", - "reference": "9882ab5d8b00617baae83c6996f5a34668c11beb" + "url": "https://github.com/php-fig/container.git", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/cache/zipball/9882ab5d8b00617baae83c6996f5a34668c11beb", - "reference": "9882ab5d8b00617baae83c6996f5a34668c11beb", + "url": "https://api.github.com/repos/php-fig/container/zipball/513e0666f7216c7459170d56df27dfcefe1689ea", + "reference": "513e0666f7216c7459170d56df27dfcefe1689ea", "shasum": "" }, "require": { - "php": ">=5.4.0", - "react/promise": "~2.0" + "php": ">=7.4.0" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" - } - }, "autoload": { "psr-4": { - "React\\Cache\\": "" + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Async caching.", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "cache" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], - "time": "2014-02-02 01:11:26" + "support": { + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/1.1.2" + }, + "time": "2021-11-05T16:50:12+00:00" }, { - "name": "react/dns", - "version": "v0.4.1", + "name": "psr/simple-cache", + "version": "1.0.1", "source": { "type": "git", - "url": "https://github.com/reactphp/dns.git", - "reference": "8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf" + "url": "https://github.com/php-fig/simple-cache.git", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/dns/zipball/8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf", - "reference": "8c5ccc35dcb4b06b70eb9201842363fac7b0f3cf", + "url": "https://api.github.com/repos/php-fig/simple-cache/zipball/408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", + "reference": "408d5eafb83c57f6365a3ca330ff23aa4a5fa39b", "shasum": "" }, "require": { - "php": ">=5.4.0", - "react/cache": "0.4.*", - "react/promise": "~2.0", - "react/socket": "0.4.*" + "php": ">=5.3.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "0.4-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "React\\Dns\\": "" + "Psr\\SimpleCache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Async DNS resolver.", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interfaces for simple caching", "keywords": [ - "dns", - "dns-resolver" + "cache", + "caching", + "psr", + "psr-16", + "simple-cache" ], - "time": "2014-04-12 14:09:10" + "support": { + "source": "https://github.com/php-fig/simple-cache/tree/master" + }, + "time": "2017-10-23T01:57:42+00:00" }, { - "name": "react/event-loop", - "version": "v0.4.1", + "name": "react/cache", + "version": "v1.2.0", "source": { "type": "git", - "url": "https://github.com/reactphp/event-loop.git", - "reference": "18c5297087ca01de85518e2b55078f444144aa1b" + "url": "https://github.com/reactphp/cache.git", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/event-loop/zipball/18c5297087ca01de85518e2b55078f444144aa1b", - "reference": "18c5297087ca01de85518e2b55078f444144aa1b", + "url": "https://api.github.com/repos/reactphp/cache/zipball/d47c472b64aa5608225f47965a484b75c7817d5b", + "reference": "d47c472b64aa5608225f47965a484b75c7817d5b", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.3.0", + "react/promise": "^3.0 || ^2.0 || ^1.1" }, - "suggest": { - "ext-event": "~1.0", - "ext-libev": "*", - "ext-libevent": ">=0.1.0" + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" - } - }, "autoload": { "psr-4": { - "React\\EventLoop\\": "" + "React\\Cache\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Event loop abstraction layer that libraries can use for evented I/O.", + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, Promise-based cache interface for ReactPHP", "keywords": [ - "event-loop" + "cache", + "caching", + "promise", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/cache/issues", + "source": "https://github.com/reactphp/cache/tree/v1.2.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } ], - "time": "2014-02-26 17:36:58" + "time": "2022-11-30T15:59:55+00:00" }, { - "name": "react/promise", - "version": "v2.2.0", + "name": "react/dns", + "version": "v1.11.0", "source": { "type": "git", - "url": "https://github.com/reactphp/promise.git", - "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef" + "url": "https://github.com/reactphp/dns.git", + "reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/promise/zipball/365fcee430dfa4ace1fbc75737ca60ceea7eeeef", - "reference": "365fcee430dfa4ace1fbc75737ca60ceea7eeeef", + "url": "https://api.github.com/repos/reactphp/dns/zipball/3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f", + "reference": "3be0fc8f1eb37d6875cd6f0c6c7d0be81435de9f", "shasum": "" }, "require": { - "php": ">=5.4.0" + "php": ">=5.3.0", + "react/cache": "^1.0 || ^0.6 || ^0.5", + "react/event-loop": "^1.2", + "react/promise": "^3.0 || ^2.7 || ^1.2.1" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.0-dev" - } + "require-dev": { + "phpunit/phpunit": "^9.5 || ^4.8.35", + "react/async": "^4 || ^3 || ^2", + "react/promise-timer": "^1.9" }, + "type": "library", "autoload": { "psr-4": { - "React\\Promise\\": "src/" - }, - "files": [ - "src/functions_include.php" - ] + "React\\Dns\\": "src/" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, { "name": "Jan Sorgalla", - "email": "jsorgalla@googlemail.com" + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } ], - "description": "A lightweight implementation of CommonJS Promises/A for PHP", - "time": "2014-12-30 13:32:42" + "description": "Async DNS resolver for ReactPHP", + "keywords": [ + "async", + "dns", + "dns-resolver", + "reactphp" + ], + "support": { + "issues": "https://github.com/reactphp/dns/issues", + "source": "https://github.com/reactphp/dns/tree/v1.11.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-06-02T12:45:26+00:00" }, { - "name": "react/socket", - "version": "v0.4.2", + "name": "react/event-loop", + "version": "v1.4.0", "source": { "type": "git", - "url": "https://github.com/reactphp/socket.git", - "reference": "a6acf405ca53fc6cfbfe7c77778ededff46aa7cc" + "url": "https://github.com/reactphp/event-loop.git", + "reference": "6e7e587714fff7a83dcc7025aee42ab3b265ae05" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket/zipball/a6acf405ca53fc6cfbfe7c77778ededff46aa7cc", - "reference": "a6acf405ca53fc6cfbfe7c77778ededff46aa7cc", + "url": "https://api.github.com/repos/reactphp/event-loop/zipball/6e7e587714fff7a83dcc7025aee42ab3b265ae05", + "reference": "6e7e587714fff7a83dcc7025aee42ab3b265ae05", "shasum": "" }, "require": { - "evenement/evenement": "~2.0", - "php": ">=5.4.0", - "react/event-loop": "0.4.*", - "react/stream": "0.4.*" + "php": ">=5.3.0" }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" - } + "require-dev": { + "phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36" }, + "suggest": { + "ext-pcntl": "For signal handling support when using the StreamSelectLoop" + }, + "type": "library", "autoload": { "psr-4": { - "React\\Socket\\": "src" + "React\\EventLoop\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Library for building an evented socket server.", + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "ReactPHP's core reactor event loop that libraries can use for evented I/O.", "keywords": [ - "Socket" + "asynchronous", + "event-loop" ], - "time": "2014-05-25 17:02:16" + "support": { + "issues": "https://github.com/reactphp/event-loop/issues", + "source": "https://github.com/reactphp/event-loop/tree/v1.4.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-05-05T10:11:24+00:00" }, { - "name": "react/socket-client", - "version": "v0.4.0", + "name": "react/promise", + "version": "v3.0.0", "source": { "type": "git", - "url": "https://github.com/reactphp/socket-client.git", - "reference": "6ec8c3aefc018acec763fa6e950e1baa947231fc" + "url": "https://github.com/reactphp/promise.git", + "reference": "c86753c76fd3be465d93b308f18d189f01a22be4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/socket-client/zipball/6ec8c3aefc018acec763fa6e950e1baa947231fc", - "reference": "6ec8c3aefc018acec763fa6e950e1baa947231fc", + "url": "https://api.github.com/repos/reactphp/promise/zipball/c86753c76fd3be465d93b308f18d189f01a22be4", + "reference": "c86753c76fd3be465d93b308f18d189f01a22be4", "shasum": "" }, "require": { - "php": ">=5.4.0", - "react/dns": "0.4.*", - "react/event-loop": "0.4.*", - "react/promise": "~2.0" + "php": ">=7.1.0" + }, + "require-dev": { + "phpstan/phpstan": "1.10.20 || 1.4.10", + "phpunit/phpunit": "^9.5 || ^7.5" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.4-dev" + "autoload": { + "files": [ + "src/functions_include.php" + ], + "psr-4": { + "React\\Promise\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" } + ], + "description": "A lightweight implementation of CommonJS Promises/A for PHP", + "keywords": [ + "promise", + "promises" + ], + "support": { + "issues": "https://github.com/reactphp/promise/issues", + "source": "https://github.com/reactphp/promise/tree/v3.0.0" }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-07-11T16:12:49+00:00" + }, + { + "name": "react/socket", + "version": "v1.13.0", + "source": { + "type": "git", + "url": "https://github.com/reactphp/socket.git", + "reference": "cff482bbad5848ecbe8b57da57e4e213b03619aa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/reactphp/socket/zipball/cff482bbad5848ecbe8b57da57e4e213b03619aa", + "reference": "cff482bbad5848ecbe8b57da57e4e213b03619aa", + "shasum": "" + }, + "require": { + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.0", + "react/dns": "^1.11", + "react/event-loop": "^1.2", + "react/promise": "^3 || ^2.6 || ^1.2.1", + "react/stream": "^1.2" + }, + "require-dev": { + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35", + "react/async": "^4 || ^3 || ^2", + "react/promise-stream": "^1.4", + "react/promise-timer": "^1.9" + }, + "type": "library", "autoload": { "psr-4": { - "React\\SocketClient\\": "" + "React\\Socket\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Async connector to open TCP/IP and SSL/TLS based connections.", + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Async, streaming plaintext TCP/IP and secure TLS socket server and client connections for ReactPHP", "keywords": [ - "Socket" + "Connection", + "Socket", + "async", + "reactphp", + "stream" ], - "time": "2014-02-02 01:11:26" + "support": { + "issues": "https://github.com/reactphp/socket/issues", + "source": "https://github.com/reactphp/socket/tree/v1.13.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } + ], + "time": "2023-06-07T10:28:34+00:00" }, { "name": "react/stream", - "version": "v0.4.2", + "version": "v1.3.0", "source": { "type": "git", "url": "https://github.com/reactphp/stream.git", - "reference": "acc7a5fec02e0aea674560e1d13c40ed0c8c5465" + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/reactphp/stream/zipball/acc7a5fec02e0aea674560e1d13c40ed0c8c5465", - "reference": "acc7a5fec02e0aea674560e1d13c40ed0c8c5465", + "url": "https://api.github.com/repos/reactphp/stream/zipball/6fbc9672905c7d5a885f2da2fc696f65840f4a66", + "reference": "6fbc9672905c7d5a885f2da2fc696f65840f4a66", "shasum": "" }, "require": { - "evenement/evenement": "~2.0", - "php": ">=5.4.0" + "evenement/evenement": "^3.0 || ^2.0 || ^1.0", + "php": ">=5.3.8", + "react/event-loop": "^1.2" }, "require-dev": { - "react/event-loop": "0.4.*", - "react/promise": "~2.0" - }, - "suggest": { - "react/event-loop": "0.4.*", - "react/promise": "~2.0" + "clue/stream-filter": "~1.2", + "phpunit/phpunit": "^9.5 || ^5.7 || ^4.8.35" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "0.5-dev" - } - }, "autoload": { "psr-4": { - "React\\Stream\\": "src" + "React\\Stream\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "Basic readable and writable stream interfaces that support piping.", + "authors": [ + { + "name": "Christian Lück", + "email": "christian@clue.engineering", + "homepage": "https://clue.engineering/" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "reactphp@ceesjankiewiet.nl", + "homepage": "https://wyrihaximus.net/" + }, + { + "name": "Jan Sorgalla", + "email": "jsorgalla@gmail.com", + "homepage": "https://sorgalla.com/" + }, + { + "name": "Chris Boden", + "email": "cboden@gmail.com", + "homepage": "https://cboden.dev/" + } + ], + "description": "Event-driven readable and writable streams for non-blocking I/O in ReactPHP", "keywords": [ + "event-driven", + "io", + "non-blocking", "pipe", - "stream" + "reactphp", + "readable", + "stream", + "writable" + ], + "support": { + "issues": "https://github.com/reactphp/stream/issues", + "source": "https://github.com/reactphp/stream/tree/v1.3.0" + }, + "funding": [ + { + "url": "https://opencollective.com/reactphp", + "type": "open_collective" + } ], - "time": "2014-09-10 03:32:31" + "time": "2023-06-16T10:52:11+00:00" } ], "packages-dev": [], @@ -399,7 +659,8 @@ "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=5.3" + "php": "^8.0" }, - "platform-dev": [] + "platform-dev": [], + "plugin-api-version": "2.3.0" } diff --git a/examples/events.php b/examples/events.php index bed124d..89d42c8 100644 --- a/examples/events.php +++ b/examples/events.php @@ -12,7 +12,7 @@ use React\Dns\Query\Executor; use React\Dns\Resolver\Resolver; use React\EventLoop\Factory; -use React\SocketClient\Connector; +use React\Socket\Connector; use React\Stream\Stream; require __DIR__ . '/../vendor/autoload.php'; diff --git a/readme.MD b/readme.MD new file mode 100644 index 0000000..289fa03 --- /dev/null +++ b/readme.MD @@ -0,0 +1,15 @@ +## package-php-react-ami + +A clearvox PHP lib with asterisk AMI + +### How to update + +1. make (code) changes + +2. regenerate composer.lock file + +``` +# https://getcomposer.org/doc/00-intro.md#docker-image +docker pull composer/composer +docker run --rm -it -v "$(pwd):/src" composer/composer install +``` \ No newline at end of file diff --git a/src/Clearvox/Asterisk/AMI/Finder/ActionFinder.php b/src/Clearvox/Asterisk/AMI/Finder/ActionFinder.php index 36fef0f..e9e5baa 100644 --- a/src/Clearvox/Asterisk/AMI/Finder/ActionFinder.php +++ b/src/Clearvox/Asterisk/AMI/Finder/ActionFinder.php @@ -1,9 +1,11 @@ "Clearvox\\Asterisk\\AMI\\Message\\Action\\AGIAction", "AbsoluteTimeout" => "Clearvox\\Asterisk\\AMI\\Message\\Action\\AbsoluteTimeoutAction", "AgentLogoff" => "Clearvox\\Asterisk\\AMI\\Message\\Action\\AgentLogoffAction", @@ -102,12 +104,15 @@ class ActionFinder "WaitEvent" => "Clearvox\\Asterisk\\AMI\\Message\\Action\\WaitEventAction", ); - public function register($name, $class) + public function register($name, $class): static { $this->actions[$name] = $class; return $this; } + /** + * @throws ReflectionException + */ public function find($name, $arguments = array()) { if (array_key_exists($name, $this->actions)) { diff --git a/src/Clearvox/Asterisk/AMI/Finder/EventFinder.php b/src/Clearvox/Asterisk/AMI/Finder/EventFinder.php index 9c44224..8eebea5 100644 --- a/src/Clearvox/Asterisk/AMI/Finder/EventFinder.php +++ b/src/Clearvox/Asterisk/AMI/Finder/EventFinder.php @@ -3,7 +3,7 @@ class EventFinder { - protected $events = array( + protected array $events = array( "AGIExec" => "Clearvox\\Asterisk\\AMI\\Message\\Event\\AGIExecEvent", "AgentConnect" => "Clearvox\\Asterisk\\AMI\\Message\\Event\\AgentConnectEvent", "Agentlogin" => "Clearvox\\Asterisk\\AMI\\Message\\Event\\AgentloginEvent", @@ -85,7 +85,7 @@ class EventFinder "vgsm_sms_rx" => "Clearvox\\Asterisk\\AMI\\Message\\Event\\vgsm_sms_rxEvent", ); - public function registerEvent($eventName, $class) + public function registerEvent($eventName, $class): void { $this->events[$eventName] = $class; } diff --git a/src/Clearvox/Asterisk/AMI/Manager.php b/src/Clearvox/Asterisk/AMI/Manager.php index 8aecf40..8e11536 100644 --- a/src/Clearvox/Asterisk/AMI/Manager.php +++ b/src/Clearvox/Asterisk/AMI/Manager.php @@ -4,7 +4,8 @@ use Clearvox\Asterisk\AMI\Message\Action\ActionMessage; use Evenement\EventEmitter; use React\Promise\Deferred; -use React\Stream\Stream; +use React\Promise\Promise; +use React\Stream\ReadableStreamInterface; /** * Holds the connected AMI Stream and has the Process class to @@ -18,19 +19,19 @@ class Manager extends EventEmitter { /** - * @var \React\Stream\Stream + * @var ReadableStreamInterface */ - protected $stream; + protected ReadableStreamInterface $stream; /** * @var Process */ - protected $process; + protected Process $process; /** * @var array */ - protected $actions = array(); + protected array $actions = array(); public function __construct(Process $process) { @@ -40,9 +41,9 @@ public function __construct(Process $process) /** * Set the stream for the Manager instance. * - * @param Stream $stream + * @param ReadableStreamInterface $stream */ - public function setStream(Stream $stream) + public function setStream(ReadableStreamInterface $stream) { $this->stream = $stream; @@ -67,9 +68,9 @@ function ($part) use ($process, $that) { * promise inside this class. * * @param ActionMessage $actionMessage - * @return \React\Promise\Promise + * @return Promise */ - public function send(ActionMessage $actionMessage) + public function send(ActionMessage $actionMessage): Promise { $deferred = new Deferred(); @@ -81,9 +82,9 @@ public function send(ActionMessage $actionMessage) /** * Get all the actions currently stored with this Manager. - * @return array | action id => Promise + * @return array id => Promise */ - public function getActions() + public function getActions(): array { return $this->actions; } diff --git a/src/Clearvox/Asterisk/AMI/Message/Message.php b/src/Clearvox/Asterisk/AMI/Message/Message.php index f0bb440..528db1c 100644 --- a/src/Clearvox/Asterisk/AMI/Message/Message.php +++ b/src/Clearvox/Asterisk/AMI/Message/Message.php @@ -31,19 +31,19 @@ abstract class Message implements Jsonable, Arrayable /** * @var array */ - protected $keys = array(); + protected array $keys = array(); /** * @var array */ - protected $variables = array(); + protected array $variables = array(); /** * Get all Keys for this message. * * @return array */ - public function getKeys() + public function getKeys(): array { return $this->keys; } @@ -54,7 +54,7 @@ public function getKeys() * @param string $key * @return string|bool */ - public function getKey($key) + public function getKey(string $key): bool|string { return (array_key_exists($key, $this->keys) ? $this->keys[$key] : false); } @@ -66,7 +66,7 @@ public function getKey($key) * @param string $value * @return $this */ - public function setKey($key, $value) + public function setKey(string $key, string $value): static { $this->keys[$key] = $value; return $this; @@ -77,7 +77,7 @@ public function setKey($key, $value) * this format: Variable: $variable=$value * @return array */ - public function getVariables() + public function getVariables(): array { return $this->variables; } @@ -88,7 +88,7 @@ public function getVariables() * @param string $variable * @return string|bool */ - public function getVariable($variable) + public function getVariable(string $variable): bool|string { return (array_key_exists($variable, $this->variables) ? $this->variables[$variable] : false); } @@ -100,7 +100,7 @@ public function getVariable($variable) * @param string $value * @return $this */ - public function setVariable($variable, $value) + public function setVariable(string $variable, string $value): static { $this->variables[$variable] = $value; return $this; @@ -111,7 +111,7 @@ public function setVariable($variable, $value) * * @return array */ - public function toArray() + public function toArray(): array { return array( 'keys' => $this->keys, @@ -125,7 +125,7 @@ public function toArray() * @param int $options * @return string */ - public function toJson($options = 0) + public function toJson($options = 0): string { return json_encode($this->toArray(), $options); } diff --git a/src/Clearvox/Asterisk/AMI/Message/OutgoingMessage.php b/src/Clearvox/Asterisk/AMI/Message/OutgoingMessage.php index f31a31f..b570306 100644 --- a/src/Clearvox/Asterisk/AMI/Message/OutgoingMessage.php +++ b/src/Clearvox/Asterisk/AMI/Message/OutgoingMessage.php @@ -21,7 +21,7 @@ class OutgoingMessage extends Message * * @return string */ - public function toString() + public function toString(): string { $prepared = array(); diff --git a/src/Clearvox/Asterisk/AMI/Message/Response/ResponseMessage.php b/src/Clearvox/Asterisk/AMI/Message/Response/ResponseMessage.php index 897ca9c..5ff1854 100644 --- a/src/Clearvox/Asterisk/AMI/Message/Response/ResponseMessage.php +++ b/src/Clearvox/Asterisk/AMI/Message/Response/ResponseMessage.php @@ -5,12 +5,12 @@ class ResponseMessage extends IncomingMessage { - public function isSuccessful() + public function isSuccessful(): bool { - return (bool) (false === strstr($this->getKey('Response'), 'Error')); + return !str_contains($this->getKey('Response'), 'Error'); } - public function getMessage() + public function getMessage(): bool|string { return $this->getKey('Message'); } diff --git a/src/Clearvox/Asterisk/AMI/Process.php b/src/Clearvox/Asterisk/AMI/Process.php index 954895d..bd2bd01 100644 --- a/src/Clearvox/Asterisk/AMI/Process.php +++ b/src/Clearvox/Asterisk/AMI/Process.php @@ -19,12 +19,12 @@ class Process /** * @var Finder\EventFinder */ - protected $eventFinder; + protected EventFinder $eventFinder; /** * @var string */ - protected $buffer = ''; + protected string $buffer = ''; public function __construct( EventFinder $eventFinder @@ -41,7 +41,7 @@ public function __construct( * @param string $part * @return array */ - public function read($part) + public function read(string $part): array { $messages = array(); $this->buffer .= $part; @@ -70,7 +70,7 @@ public function read($part) * @param Manager $manager * @param $message */ - public function run(Manager $manager, $message) + public function run(Manager $manager, $message): void { $eventPosition = strpos($message, 'Event:'); $responsePosition = strpos($message, 'Response:'); @@ -108,7 +108,7 @@ public function run(Manager $manager, $message) * @param string $message * @return string */ - protected function determineEventName($eventPosition, $message) + protected function determineEventName(int $eventPosition, string $message): string { $eventNameStart = $eventPosition + 7;