Official Laravel source
AttributeIlluminate\Container\Attributes\Singleton

#[Singleton]

Ensures that a single instance of the target element is used throughout the application.

Available since

Laravel 13.0

Targets

class

Parameters

Nenhum parâmetro obrigatório ou opcional.

Practical usage

use Illuminate\Container\Attributes\Singleton;

class ReportsController {
    public function __invoke(#[Singleton] ReportService $reportService): array
    {
        return ['status' => 'ok'];
    }
}