dayvsonspacca/beacon-contracts

Contracts (client interface and value objects) for the Beacon event platform

Maintainers

Package info

github.com/dayvsonspacca/php-beacon-contracts

pkg:composer/dayvsonspacca/beacon-contracts

Transparency log

Statistics

Installs: 2

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.0 2026-07-09 20:28 UTC

This package is auto-updated.

Last update: 2026-07-09 20:35:36 UTC


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\ClientInterfacepublish(Event): EventId and subscribe(): void
  • Beacon\Event — topic + data payload, validated on construction
  • Beacon\EventId — identifier returned by a publish
  • Beacon\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
    {
        // ...
    }
}

License

MIT