定制 socialdept/atp-signals 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

socialdept/atp-signals

最新稳定版本:v1.1.0

Composer 安装命令:

composer require socialdept/atp-signals

包简介

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

README 文档

README

Signal Header

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


What is Signal?

Signal is a Laravel package that lets you respond to real-time events from the AT Protocol network. Build reactive applications, custom feeds, moderation tools, analytics systems, and AppViews by listening to posts, likes, follows, and other social interactions as they happen across Bluesky and the entire AT Protocol ecosystem.

Think of it as Laravel's event listeners, but for the decentralized social web.

Why use Signal?

  • Laravel-style code - Familiar patterns you already know
  • Real-time processing - React to events as they happen
  • Dual-mode support - Choose Jetstream (efficient JSON) or Firehose (comprehensive CBOR)
  • AppView ready - Full support for custom collections and protocols
  • Production features - Queue integration, cursor management, auto-reconnection
  • Easy filtering - Target specific collections, operations, and users with wildcards
  • Built-in testing - Test your signals with sample data

Quick Example

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
    {
        $record = $event->getRecord();

        logger()->info('New post created', [
            'did' => $event->did,
            'text' => $record->text ?? null,
        ]);
    }
}

Run php artisan signal:consume and start responding to every post on Bluesky in real-time.

Installation

composer require socialdept/atp-signals
php artisan signal:install

That's it. Read the installation docs →

Getting Started

Once installed, you're three steps away from consuming AT Protocol events:

1. Create a Signal

php artisan make:signal NewPostSignal

2. Define What to Listen For

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

3. Start Consuming

php artisan signal:consume

Your Signal will now handle every matching event from the network. Read the quickstart guide →

What can you build?

  • Custom feeds - Curate content based on your own algorithms
  • Moderation tools - Detect and flag problematic content automatically
  • Analytics platforms - Track engagement, trends, and network growth
  • Social integrations - Mirror content to other platforms in real-time
  • Notification systems - Alert users about relevant activity
  • AppViews - Build custom AT Protocol applications with your own collections

Documentation

Getting Started

Building Signals

Advanced

Example Use Cases

Track User Growth

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

Monitor Content Moderation

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

public function shouldQueue(): bool
{
    return true; // Process in background
}

Build Custom Collections (AppView)

public function collections(): ?array
{
    return ['app.yourapp.custom.collection'];
}

See more examples →

Key Features Explained

Jetstream vs Firehose

Signal supports two modes for consuming AT Protocol events:

  • Jetstream (default) - Simplified JSON events with server-side filtering
  • Firehose - Raw CBOR/CAR format with client-side filtering

Learn more about modes →

Wildcard Filtering

Match multiple collections with patterns:

public function collections(): ?array
{
    return [
        'app.bsky.feed.*',      // All feed events
        'app.bsky.graph.*',     // All graph events
        'app.yourapp.*',        // All your custom collections
    ];
}

Learn more about filtering →

Queue Integration

Process events asynchronously for better performance:

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

Learn more about queues →

Available Commands

# Install Signal
php artisan signal:install

# Create a new Signal
php artisan make:signal YourSignal

# List all registered Signals
php artisan signal:list

# Start consuming events
php artisan signal:consume

# Test a Signal with sample data
php artisan signal:test YourSignal

Requirements

  • PHP 8.2+
  • Laravel 11+
  • WebSocket support (enabled by default)

Resources

Support & Contributing

Found a bug or have a feature request? Open an issue.

Want to contribute? We'd love your help! Check out the contribution guidelines.

Credits

License

Signal is open-source software licensed under the MIT license.

Built for the Federation • By Social Dept.

统计信息

  • 总下载量: 104
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 4
  • 点击次数: 0
  • 依赖项目数: 1
  • 推荐数: 0

GitHub 信息

  • Stars: 4
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-10-31