Something went wrong. Try again.
Build Reactive Signals for Bluesky's AT Protocol Firehose in Laravel
Something went wrong. Try again.
1.2 kB · 46 lines
PHP
at dev
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647<?php
namespace SocialDept\AtpSignals\Commands;
use Illuminate\Console\GeneratorCommand;use Symfony\Component\Console\Input\InputOption;
class MakeSignalCommand extends GeneratorCommand{ protected $name = 'make:signal';
protected $description = 'Create a new Signal class';
protected $type = 'Signal';
protected function getStub(): string { return __DIR__ . '/../../stubs/signal.stub'; }
protected function getDefaultNamespace($rootNamespace): string { return $rootNamespace . '\\Signals'; }
protected function buildClass($name): string { $stub = parent::buildClass($name);
$eventType = $this->option('type') ?? 'commit'; $collection = $this->option('collection') ?? 'app.bsky.feed.post';
$stub = str_replace('{{ eventType }}', $eventType, $stub); $stub = str_replace('{{ collection }}', $collection, $stub);
return $stub; }
protected function getOptions(): array { return [ ['type', 't', InputOption::VALUE_OPTIONAL, 'The event type (commit, identity, account)'], ['collection', 'c', InputOption::VALUE_OPTIONAL, 'The collection to watch'], ]; }}