Module
Default CLI module definition.
The module wires CLI task namespaces, dispatcher defaults, router defaults, and core model namespaces for the built-in command runtime. Applications can subclass or replace this module when they need different task namespaces or service defaults, but should keep the same dispatcher/router contracts.
- Full name:
\PhalconKit\Modules\Cli\Module - Parent class:
\PhalconKit\Cli\Module
Properties
name
Module name written into router defaults.
public string $name
Inherited methods
registerAutoloaders
Register task/model namespaces for the CLI module.
public registerAutoloaders(\Phalcon\Di\DiInterface|null $container = null): void
When a loader service is registered, it must be a Phalcon autoloader. Otherwise the module creates a local loader so lightweight CLI modules do not need to pre-register one.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$container | \Phalcon\Di\DiInterface|null | Optional container supplied by |
| Phalcon's module registration flow. |
Throws:
When the registered loader is not compatible. - ServiceException
registerServices
Resolve and configure dispatcher/router services for CLI execution.
public registerServices(\Phalcon\Di\DiInterface $container): void
Registered replacements for dispatcher and router are resolved through the shared service resolver so invalid module wiring fails before the module mutates service state.
Parameters:
| Parameter | Type | Description |
|---|---|---|
$container | \Phalcon\Di\DiInterface | Container receiving the configured module |
| services. |
Throws:
When resolved module services are incompatible. - ServiceException
getNamespaces
Return namespace-to-directory mappings registered by the module loader.
public getNamespaces(): array<string,string>
getServices
Resolve module-owned services from DI or create local defaults.
public getServices(\Phalcon\Di\DiInterface|null $container = null): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$container | \Phalcon\Di\DiInterface|null | Optional DI container used by Phalcon |
| module registration. |
Throws:
When a registered replacement service has the wrong type or cannot be resolved. - ServiceException
setServices
Store resolved module services back into the active DI container.
public setServices(\Phalcon\Di\DiInterface $container): void
Parameters:
| Parameter | Type | Description |
|---|---|---|
$container | \Phalcon\Di\DiInterface | Container that should receive the resolved |
| config, dispatcher, loader, and router services. |
getDefaultNamespace
Return the default task namespace for dispatcher routing.
public getDefaultNamespace(): string
getDirname
Return the filesystem directory that contains this module class.
public getDirname(): string
getNamespace
Return the PHP namespace for this module class.
public getNamespace(): string