Download the PHP package utopia-php/cloudevents without Composer
On this page you can find all versions of the php package utopia-php/cloudevents. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download utopia-php/cloudevents
More information about utopia-php/cloudevents
Files in utopia-php/cloudevents
Package cloudevents
Short Description Lite & fast micro PHP CloudEvents implementation that is **easy to use**.
License MIT
Informations about the package cloudevents
Utopia CloudEvents
Utopia CloudEvents is a modern PHP 8.3 implementation of the CloudEvents v1.0 specification. It provides a simple, type-safe way to work with CloudEvents in your PHP applications.
Although part of the Utopia Framework family, the library is framework-agnostic and can be used in any PHP project.
Installation
The library requires PHP 8.3+.
What are CloudEvents?
CloudEvents is a specification for describing event data in a common way. It provides a standardized format for event producers and consumers to communicate, making it easier to build event-driven architectures.
Learn more at the CloudEvents specification.
Quick Start
Creating a CloudEvent
Converting to Array
Creating from Array
Validating a CloudEvent
CloudEvent Properties
The CloudEvent class supports the following properties according to the CloudEvents v1.0 specification:
- specversion (required): CloudEvents specification version (default: "1.0")
- type (required): Event type identifier (e.g., "user.created", "v1-stats-usage")
- source (required): Context in which the event occurred (e.g., service name)
- subject (optional): Subject of the event (e.g., project ID, user ID)
- id (required): Unique identifier for the event
- time (required): Timestamp when the event occurred (RFC3339 format)
- datacontenttype (optional): Content type of the data field (default: "application/json")
- data (required): Event payload as an array
Use Cases
- Event-Driven Architecture: Standardize event formats across microservices
- Message Queues: Send CloudEvents via RabbitMQ, Kafka, or other message brokers
- Webhooks: Deliver CloudEvents to external systems
- Event Sourcing: Store cloudevents in a standardized format
- Serverless Functions: Trigger functions with CloudEvents
Development
- Install dependencies:
composer install - Static analysis:
composer check - Coding standards:
composer lint(usecomposer formatto auto-fix) - Tests:
composer test
License
MIT