phpinnacle / ridge
PHPinnacle async AMQP client
Installs: 30 319
Dependents: 3
Suggesters: 0
Security: 0
Stars: 50
Watchers: 7
Forks: 13
Open Issues: 3
Requires
- php: >=8.1
- amphp/amp: v2.6.*
- amphp/socket: v1.2.*
- evenement/evenement: v3.0.*
- phpinnacle/buffer: v1.2.*
Requires (Dev)
- phpstan/phpstan: ^1.10
- phpunit/phpunit: 10.* || 11.*
- vimeo/psalm: 5.*
README
This library is a pure asynchronous PHP implementation of the AMQP 0-9-1 protocol.
Code is mostly based on bunnyphp, but use amphp for async operations.
Install
Via Composer
$ composer require phpinnacle/ridge
Basic Usage
<?php use Amp\Loop; use PHPinnacle\Ridge\Channel; use PHPinnacle\Ridge\Client; use PHPinnacle\Ridge\Message; require __DIR__ . '/vendor/autoload.php'; Loop::run(function () { $client = Client::create('amqp://user:pass@localhost:5672'); yield $client->connect(); /** @var Channel $channel */ $channel = yield $client->channel(); yield $channel->queueDeclare('queue_name'); for ($i = 0; $i < 10; $i++) { yield $channel->publish("test_$i", '', 'queue_name'); } yield $channel->consume(function (Message $message, Channel $channel) { echo $message->content() . \PHP_EOL; yield $channel->ack($message); }, 'queue_name'); });
More examples can be found in examples
directory.
Testing
$ composer tests
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CONDUCT for details.
Security
If you discover any security related issues, please email dev@phpinnacle.com instead of using the issue tracker.
Credits
License
The MIT License (MIT). Please see License File for more information.