dayvsonspacca / beacon-contracts
Contracts (client interface and value objects) for the Beacon event platform
Package info
github.com/dayvsonspacca/php-beacon-contracts
pkg:composer/dayvsonspacca/beacon-contracts
v1.0.0
2026-07-09 20:28 UTC
Requires
- php: >=8.4
- php-standard-library/type: ^6.2
Requires (Dev)
- carthage-software/mago: ^1.43.0
- phpunit/phpunit: ^13.2
Suggests
- dayvsonspacca/beacon-guzzle-client: Ready-to-use Guzzle implementation of the Beacon contracts
README
Contracts for the Beacon event platform: the client interface and value objects. No HTTP code — bring your own client, or use dayvsonspacca/beacon-guzzle-client.
Developed in the php-beacon monorepo; this repository is a read-only split.
Installation
composer require dayvsonspacca/beacon-contracts
What's inside
Beacon\ClientInterface—publish(Event): EventIdandsubscribe(): voidBeacon\Event— topic + data payload, validated on constructionBeacon\EventId— identifier returned by a publishBeacon\Token— client authentication token
Implementing your own client
use Beacon\ClientInterface; use Beacon\Event; use Beacon\EventId; final readonly class MyBeaconClient implements ClientInterface { public function publish(Event $event): EventId { // POST {"topic": $event->topic, "data": $event->data} to your Beacon server // and wrap the returned id: return new EventId($idFromResponse); } public function subscribe(): void { // ... } }