lthn.io/app/Core/Events/SearchRequested.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

66 lines
1.5 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 search functionality is requested.
*
* Modules listen to this event to register searchable models or search
* providers. This enables lazy loading of search indexing dependencies
* until search is actually needed.
*
* ## When This Event Fires
*
* Fired when the search system initializes, typically when a search
* query is performed or search indexing is triggered.
*
* ## Usage Example
*
* ```php
* public static array $listens = [
* SearchRequested::class => 'onSearch',
* ];
*
* public function onSearch(SearchRequested $event): void
* {
* $event->searchable(Product::class);
* $event->searchable(Article::class);
* }
* ```
*/
class SearchRequested extends LifecycleEvent
{
/** @var array<int, string> Collected searchable model class names */
protected array $searchableRequests = [];
/**
* Register a searchable model.
*
* @param string $model Fully qualified model class name
*/
public function searchable(string $model): void
{
$this->searchableRequests[] = $model;
}
/**
* Get all registered searchable model class names.
*
* @return array<int, string>
*
* @internal Used by search system
*/
public function searchableRequests(): array
{
return $this->searchableRequests;
}
}