lthn.io/app/Core/Search/Boot.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

80 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\Search;
use App\Services\Search\UnifiedSearchService;
use Core\Search\Analytics\SearchAnalytics;
use Core\Search\Suggestions\SearchSuggestions;
use Illuminate\Support\ServiceProvider;
/**
* Search module service provider.
*
* Unified search across all system components.
*/
class Boot extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
$this->mergeConfigFrom(__DIR__.'/config.php', 'search');
$this->app->singleton(Unified::class);
$this->app->singleton(SearchAnalytics::class);
$this->app->singleton(SearchSuggestions::class);
$this->registerBackwardCompatAliases();
}
/**
* Bootstrap services.
*/
public function boot(): void
{
$this->loadMigrations();
$this->publishConfig();
}
/**
* Load migrations for search analytics.
*/
protected function loadMigrations(): void
{
if ($this->app->runningInConsole()) {
$this->loadMigrationsFrom(__DIR__.'/Analytics/migrations');
}
}
/**
* Publish configuration.
*/
protected function publishConfig(): void
{
if ($this->app->runningInConsole()) {
$this->publishes([
__DIR__.'/config.php' => config_path('search.php'),
], 'search-config');
}
}
/**
* Register backward compatibility aliases for old namespaces.
*/
protected function registerBackwardCompatAliases(): void
{
if (! class_exists(UnifiedSearchService::class)) {
class_alias(Unified::class, UnifiedSearchService::class);
}
}
}