Download the PHP package quarks-tech/protoevent-php without Composer
On this page you can find all versions of the php package quarks-tech/protoevent-php. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download quarks-tech/protoevent-php
More information about quarks-tech/protoevent-php
Files in quarks-tech/protoevent-php
Package protoevent-php
Short Description PHP implementation for ProtoEvent with CloudEvents and AMQP support
License MIT
Informations about the package protoevent-php
ProtoEvent PHP
PHP implementation for ProtoEvent with CloudEvents 1.0 and AMQP support.
Features
- CloudEvents 1.0 compliant - Full support for CloudEvents metadata
- Binary and Structured content modes - Flexible message marshaling
- Parking lot pattern - Automatic retries with exponential backoff
- Graceful shutdown - Handles SIGTERM/SIGINT signals
- Symfony integration - Optional bundle for auto-wiring and console commands
- Code generation - protoc plugin generates type-safe publishers and handlers
- In-memory transport - For testing without RabbitMQ
- Interceptors - Middleware support for publishers and subscribers
Requirements
- PHP 8.0+
- ext-amqp (php-amqp extension)
- RabbitMQ 3.x
Installation
For Symfony, also install the required dependencies:
Quick Start
Publishing Events
Consuming Events
Code Generation
Install the protoc plugin:
Generate code:
Generated Files
For each proto file with event messages (marked with (quarks_tech.protoevent.v1.enabled) = true):
EventBus/ServiceDesc.php- Service descriptorEventBus/EventPublisher.php- Typed publisher interfaceEventBus/Publisher.php- Publisher implementationEventBus/Registration.php- Handler registration functionsEventBus/Handler/*EventHandler.php- Handler interfaces
Symfony Integration
Bundle Registration
Configuration
Event Handlers
One handler class per event. Just implement the generated interface:
Handlers are auto-discovered. Events are routed based on type.
Console Commands
Run consumers for specific queues (ideal for Kubernetes deployments):
All registered handlers are available to all queues. The subscriber automatically routes incoming events to the matching handler.
Testing with InMemoryTransport
Use the in-memory transport for unit and integration tests:
Interceptors
Add cross-cutting concerns with interceptors:
Architecture
Parking Lot Pattern
Failed messages flow through a retry cycle:
Queue naming:
{queue}- main processing queue{queue}.wait- wait queue with TTL backoff{queue}.pl- parking lot for permanently failed messages{queue}.dlx- dead letter exchange
Message Marshaling
Binary mode (default): CloudEvents attributes in AMQP headers, payload in body.
Structured mode: Full CloudEvents JSON document in message body (use content type application/cloudevents+json).
Notes:
- Setting
application/cloudevents+jsonimplies JSON payload encoding (protobuf JSON for protobuf messages), matching the Go implementation. - Timestamps are emitted as RFC3339 without fractional seconds for cross-language compatibility.
License
MIT
All versions of protoevent-php with dependencies
ext-amqp Version *
google/protobuf Version ^3.25|^4.0
ramsey/uuid Version ^4.7
psr/log Version ^2.0|^3.0