lthn.io/app/Core/Events/QueueWorkerBooting.php
Claude 41a90cbff8
feat: lthn.io API serving live chain data
Fixed: basePath self→static binding, namespace detection, event wiring,
SQLite cache, file cache driver. All Mod Boot classes converted to
$listens pattern for lifecycle event discovery.

Working endpoints:
- /v1/explorer/info — live chain height, difficulty, aliases
- /v1/explorer/stats — formatted chain statistics
- /v1/names/directory — alias directory grouped by type
- /v1/names/available/{name} — name availability check
- /v1/names/lookup/{name} — name details

Co-Authored-By: Charon <charon@lethean.io>
2026-04-03 17:17:42 +01:00

74 lines
1.8 KiB
PHP

<?php
/*
* Core PHP Framework
*
* Licensed under the European Union Public Licence (EUPL) v1.2.
* See LICENSE file for details.
*/
declare(strict_types=1);
namespace Core\Events;
/**
* Fired when a queue worker is starting up.
*
* Modules listen to this event to perform queue-specific initialization or
* register job classes that need explicit registration.
*
* ## When This Event Fires
*
* Fired by `LifecycleEventProvider::fireQueueWorkerBooting()` when the
* application detects it's running in queue worker context (i.e., when
* `queue.worker` is bound in the container).
*
* Not fired during web requests, API calls, or console commands.
*
* ## Usage Example
*
* ```php
* public static array $listens = [
* QueueWorkerBooting::class => 'onQueueWorker',
* ];
*
* public function onQueueWorker(QueueWorkerBooting $event): void
* {
* $event->job(ProcessOrderJob::class);
* $event->job(SendNotificationJob::class);
* }
* ```
*
* Note: Most Laravel jobs don't need explicit registration. This event
* is primarily for queue-specific initialization or custom job handling.
*
*
* @see ConsoleBooting For CLI-specific initialization
*/
class QueueWorkerBooting extends LifecycleEvent
{
/** @var array<int, string> Collected job class names */
protected array $jobRequests = [];
/**
* Register a job class.
*
* @param string $class Fully qualified job class name
*/
public function job(string $class): void
{
$this->jobRequests[] = $class;
}
/**
* Get all registered job class names.
*
* @return array<int, string>
*
* @internal Used by LifecycleEventProvider
*/
public function jobRequests(): array
{
return $this->jobRequests;
}
}