event-engine/php-schema
Event Engine PHP Schema provides PHP type definitions to describe and validate event-driven message payloads. Define schemas for commands, events, and queries with reusable types, enabling consistent serialization, documentation, and tooling across your services.
Event::dispatch()), but may require custom adapters for non-Laravel event buses (e.g., RabbitMQ, Kafka).Illuminate\Contracts\Events\Dispatcher or using middleware.spatie/fractal for API responses or symfony/yaml for schema parsing if not JSON).spatie/array-to-object suffice?php-event-sourcing/php-event)?Event class to include schema validation in handle() or via middleware.event-engine/php-schema in a listener’s __invoke).FormRequest or ApiResource).justinrainbow/json-schema).UserRegistered event listener.schema_version in event payloads).ShouldBeSerializable trait may conflict.OrderCreated, UserUpdated).config/event-schemas.php) or a database table.SchemaValidatableEvent trait or middleware to reuse validation logic.trait SchemaValidatableEvent {
public function validate(): void {
$schema = Schema::getSchemaForEvent(static::class);
$validator = new SchemaValidator($schema);
$validator->validate($this->payload);
}
}
PHPUnit and Mockery).SchemaValidationException with detailed paths.v2, consumer expects v1).How can I help you explore Laravel packages today?