Download the PHP package pablicio/mirabel-rabbitmq without Composer

On this page you can find all versions of the php package pablicio/mirabel-rabbitmq. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package mirabel-rabbitmq

Mirabel RabbitMQ

Framework-agnostic RabbitMQ primitives for PHP 8.2+, built on php-amqplib/php-amqplib — the mature, battle-tested AMQP client created by Vadim Zaliva and Alvaro Videla and kept alive by its community; it is the client the official RabbitMQ PHP tutorials use. Mirabel does not replace it: it stands on it and packages the decisions every service ends up repeating (topology, retries, error queues, envelopes) behind one class per event, one class per worker and one verb to use each: publish() and subscribe().

Documentação completa (pt-BR): docs/README.md · Changes: CHANGELOG.md

Install

The core reads its connection lazily from the process environment:

Publish

The constant is optional: without it the routing key comes from the class name (OrderReceived → order.received, PedidoPagoEvent → pedido.pago). OrderReceived::routingKey() shows what was resolved.

With MB_RABBITMQ_PUBLISHER_CONFIRMS=true, publish() returns only after the broker has accepted the message, and throws PublishNotConfirmedException when it refuses it. Transport failures are retried a bounded number of times (MB_RABBITMQ_PUBLISH_RETRIES) with the same message_id.

Consume

Every constant is optional. What is left out follows a convention:

Constant Meaning When omitted
QUEUE queue name class name in kebab case, without Worker (ChargeOrder → charge-order)
EVENTS event classes to subscribe to —
ROUTING_KEYS extra routing keys (*/# allowed) —
ATTEMPTS deliveries before the error queue 1
RETRY_DELAY milliseconds in the retry queue 0
PREFETCH unacked messages per consumer broker default
QUEUE_TYPE classic or quorum classic
EXCHANGE_TYPE exchange type MB_RABBITMQ_EXCHANGE_TYPE

EVENTS and ROUTING_KEYS add up. ChargeOrder::definition() returns the queue, keys, retry and options the worker will declare.

The handler... The worker...
returns acks the message
throws, or calls $envelope->nack() sends it to <queue>.retry; on the last attempt, to <queue>.error
calls $envelope->reject() parks it in <queue>.error right away
receives a body that is not JSON parks it in <queue>.error without calling the handler

Attempts are read from RabbitMQ's x-death header, so the count survives worker restarts. A retried message returns only to the queue that failed, never to other queues bound to the same routing key. Parked messages carry x-mirabel-failure-reason, x-mirabel-attempts and x-mirabel-exception headers.

The classic work($msg) API with const QUEUE, routing_keys, options and retry_options, and the static properties ($routingKey, $queue, $routingKeys, $retry, $options), are still supported. When both are present, the uppercase constant wins.

In Laravel, package discovery registers an optional bridge: the MB_RABBITMQ_* variables survive config:cache, the library logs to the Laravel log, and php artisan mirabel:work EmitirNotaFiscal runs a worker. The core does not depend on Laravel.

A worker also operates its own queues: pending(), counts(), peek(), failed() with Envelope::failure(), reprocess($which), discard($which) and purge(). Queues can be capped (MAX_LENGTH, OVERFLOW), events can be MANDATORY, and the outbox and the idempotency store come ready for PDO (PdoOutboxStore, PdoIdempotencyStore).

Delivery is at-least-once: handlers should be idempotent. A worker can plug in an IdempotencyStoreInterface to skip messages it has already processed.

$worker->stop() (or SIGTERM/SIGINT with ext-pcntl) finishes the current message and leaves subscribe().

Test

Disclaimer

Mirabel is a small library built for learning and for small services. Read the limitations section of the docs before putting it in front of money.


All versions of mirabel-rabbitmq with dependencies

PHP Build Version
Package Version
Requires php-amqplib/php-amqplib Version ^3.5
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package pablicio/mirabel-rabbitmq contains the following files

Loading the files please wait ...