Search by

socialdept / atp-signals

socialdept

Build Reactive Signals for Bluesky's AT Protocol Firehose in Laravel

Package info

github.com/socialdept/atp-signals

pkg:composer/socialdept/atp-signals

Statistics

Installs: 1 521

Dependents: 3

Suggesters: 2

Stars: 4

Open Issues: 2

v2.3.3 2026-10-22 03:55 UTC

README

Signal Header

Consume real-time AT Protocol events in your Laravel application.


This package lets a Laravel application react to AT Protocol events as they happen. A Signal is a class that names the events it wants, by event type, collection, operation or DID, and handles each one, in the consumer process or on a queue. Events come from Jetstream, the firehose or an Obelisk archive, and the cursor is saved so a restarted consumer resumes where it stopped. For code that keeps its own cursor, Jetstream v2 and labeler streams deliver events and labels in batches. To learn all about it, head over to the documentation.

Here are a few short examples of what you can do. Write a Signal that handles every new post:

use SocialDept\AtpSignals\Events\SignalEvent;
use SocialDept\AtpSignals\Signals\Signal;

class NewPostSignal extends Signal
{
    public function eventTypes(): array
    {
        return ['commit'];
    }

    public function collections(): ?array
    {
        return ['app.bsky.feed.post'];
    }

    public function handle(SignalEvent $event): void
    {
        logger()->info('New post', [
            'did' => $event->did,
            'text' => $event->getRecord()->text ?? null,
        ]);
    }
}

Match several collections with a wildcard, and only the operations you care about:

use SocialDept\AtpSignals\Enums\SignalCommitOperation;

public function collections(): ?array
{
    return ['app.bsky.feed.*', 'app.bsky.graph.*'];
}

public function operations(): ?array
{
    return [SignalCommitOperation::Create];
}

Handle events on a queue instead of in the consumer:

public function shouldQueue(): bool
{
    return true;
}

Then start consuming:

php artisan signal:consume

Documentation

You'll find the documentation on https://socialde.pt/docs/atp-signals.

Find yourself stuck using the package? Found a bug? Do you have general questions or suggestions for improving it? Feel free to create an issue on GitHub.

Testing

vendor/bin/phpunit

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see LICENSE for more information.