HandlerReference
An immutable, framework-agnostic pointer to the code a route runs: a controller class plus the method that handles the request (defaulting to `__invoke` for a single-action handler class). Serializable, so route tables can be compiled and cached; a {@see HandlerResolverInterface} turns it into a live PSR-15 request handler.
HandlerReference::__construct()
public function __construct(string $controller, string $method = '__invoke'):Parameters
| Name | Type | Description |
|---|---|---|
| $controller | class-string | the handler class |
| $method | string | the method that handles the request |
HandlerReference::action()
public static function action(string $controller): selfReference a single-action handler class through its `__invoke` method.
Parameters
| Name | Type | Description |
|---|---|---|
| $controller | class-string |
HandlerReference::method()
public static function method(string $controller, string $method): selfReference a specific method on a controller class.
Parameters
| Name | Type | Description |
|---|---|---|
| $controller | class-string | |
| $method | string |
HandlerReference::of()
public static function of(array $handler): selfThe reference behind `[Controller::class, 'method']` — the way a route names its handler. Anything else is refused here, by shape and naming what was received: a route whose handler cannot be resolved would otherwise surface at dispatch, as a 500 to whoever asked, instead of at declaration, to whoever wrote it. Only the pair is accepted: a bare `Controller::class` for a single-action handler arrives with its first consumer in the family (greenhouse decisions/0388).
Parameters
| Name | Type | Description |
|---|---|---|
| $handler | array<mixed> |
HandlerReference::__toString()
public function __toString(): stringRender the reference as `Controller::method`.