插件 Class
Queue 的插件
命名空间: Cake\Queue
常量
-
list<string>
VALID_HOOKS ¶['bootstrap', 'console', 'middleware', 'routes', 'services', 'events']
有效的钩子列表。
属性摘要
-
$bootstrapEnabled protected
bool
是否执行引导
-
$classPath protected
string|null
此插件的类路径。
-
$configPath protected
string|null
此插件的配置路径。
-
$consoleEnabled protected
bool
控制台中间件
-
$eventsEnabled protected
bool
是否加载事件
-
$middlewareEnabled protected
bool
启用中间件
-
$name protected
string|null
插件名称。
-
$path protected
string|null
此插件的路径。
-
$routesEnabled protected
bool
是否加载路由
-
$servicesEnabled protected
bool
注册容器服务
-
$templatePath protected
string|null
此插件的模板路径。
方法摘要
-
__construct() public
构造函数
-
bootstrap() public
加载 Queue 配置
-
checkHook() protected
检查钩子名称是否有效
-
console() public
为插件添加控制台命令。
-
disable() public
禁用指定的钩子
-
enable() public
启用指定的钩子
-
events() public
注册应用程序事件。
-
getClassPath() public
获取此插件配置的目录路径
-
getConfigPath() public
获取此插件配置的目录路径
-
getName() public
获取此插件的名称。
-
getPath() public
获取此插件的目录路径
-
getTemplatePath() public
获取此插件模板的目录路径
-
initialize() public
从构造函数调用的初始化钩子。
-
isEnabled() public
检查指定的钩子是否已启用
-
middleware() public
为插件添加中间件。
-
routes() public
为插件添加路由。
-
services() public
将 DI 容器添加到 Worker 命令
方法详情
__construct() ¶ public
__construct(array<string, mixed> $options = [])
构造函数
参数
-
array<string, mixed>
$options optional 选项
bootstrap() ¶ public
bootstrap(Cake\Core\PluginApplicationInterface $app): void
加载 Queue 配置
此方法的默认实现将在插件中包含 config/bootstrap.php
(如果存在)。您可以覆盖此方法来替换该行为。
主机应用程序作为参数提供。这使您可以加载额外的插件依赖项,或附加事件。
参数
-
Cake\Core\PluginApplicationInterface
$app 主机应用程序
返回
void
checkHook() ¶ protected
checkHook(string $hook): void
检查钩子名称是否有效
参数
-
string
$hook 要检查的钩子名称
返回
void
抛出
InvalidArgumentException
在无效的钩子上
console() ¶ public
console(Cake\Console\CommandCollection $commands): Cake\Console\CommandCollection
为插件添加控制台命令。
参数
-
Cake\Console\CommandCollection
$commands 要更新的命令集合
返回
Cake\Console\CommandCollection
events() ¶ public
events(Cake\Event\EventManagerInterface $eventManager): Cake\Event\EventManagerInterface
注册应用程序事件。
参数
-
Cake\Event\EventManagerInterface
$eventManager 要注册监听器的全局事件管理器
返回
Cake\Event\EventManagerInterface
middleware() ¶ public
middleware(Cake\Http\MiddlewareQueue $middlewareQueue): Cake\Http\MiddlewareQueue
为插件添加中间件。
参数
-
Cake\Http\MiddlewareQueue
$middlewareQueue
返回
Cake\Http\MiddlewareQueue
routes() ¶ public
routes(Cake\Routing\RouteBuilder $routes): void
为插件添加路由。
此方法的默认实现将在插件中包含 config/routes.php
(如果存在)。您可以覆盖此方法来替换该行为。
参数
-
Cake\Routing\RouteBuilder
$routes
返回
void
services() ¶ public
services(Cake\Core\ContainerInterface $container): void
将 DI 容器添加到 Worker 命令
参数
-
Cake\Core\ContainerInterface
$container DI 容器
返回
void