RegisterService
Marks a class as a service to be auto-registered in the DI container. A service scanner discovers classes carrying this attribute, instantiates each one (honoring {@see $factory} and {@see $dependencies}), and registers the resulting instance through {@see \Milpa\app\Interfaces\Di\DIContainerInterface::registerService()}. Because a concrete instance is registered, the service is effectively a singleton (one shared instance); an explicit `registerService()` for the same id takes precedence over `resolve()` autowiring.
RegisterService::__construct()
public function __construct(?string $id = null, array $dependencies = [], ?string $factory = null):Parameters
| Nombre | Tipo | Descripción |
|---|---|---|
| $id | (string | null) | Service identifier (defaults to the class name) |
| $dependencies | array<int, class-string> | Dependency class names for constructor injection |
| $factory | (string | null) | Static factory method name if custom instantiation is needed |