spiralle/clockwork
Composer 安装命令:
composer require spiralle/clockwork
包简介
Clockwork integration for Spiral Framework
README 文档
README
spiralle/clockwork is a seamless integration library that connects the Spiral Framework with Clockwork, bringing enhanced runtime insights to your Spiral-based PHP applications. This library extends Clockwork’s powerful monitoring and debugging tools, making it easy to track request data, performance metrics, database queries, and more, specifically tailored for the Spiral ecosystem. With this bridge, you can efficiently monitor your HTTP requests, console commands, queue jobs, and tests within the familiar Clockwork interface, empowering you to optimize and debug your Spiral applications with ease.
Installation
composer require spiralle/clockwork
Configuration
Interceptions
To enable Clockwork interception, you need to add the ClockworkInterceptor to your application's bootloaders.
This interceptor will automatically capture and log all HTTP requests, console commands, and queue jobs.
It collects data such as the controller duration and controller/action name, and sends it to Clockwork.
final class AppBootloader extends DomainBootloader { protected const INTERCEPTORS = [ClockworkInterceptor::class]; }
Bootloaders
public function defineBootloaders(): array { return [ // ... // Clockwork Scope - Required ClockworkBootloader::class, // Displays middlewares in the "middleware" section ClockworkMiddlewareBootloader::class => new BootloadConfig(allowEnv: ['APP_ENV' => ['local']]), // Displays database queries in the "database" tab ClockworkCycleBootloader::class => new BootloadConfig(allowEnv: ['APP_ENV' => ['local']]), // Displays cache queries in the "cache" tab ClockworkCacheBootloader::class => new BootloadConfig(allowEnv: ['APP_ENV' => ['local']]), // Adds the Clockwork Monolog Handler ClockworkLoggingBootloader::class => new BootloadConfig(allowEnv: ['APP_ENV' => ['local']]), // ... ]; }
Middlewares
To collect DataSources and common data, you need to add the ClockworkMiddlewareBootloader to your application's bootloaders.
final class RoutesBootloader extends BaseRoutesBootloader
{
protected function globalMiddleware(): array
{
return [
// Should be the first middleware - Required
ClockworkMiddleware::class,
];
}
}
Environment
To enable Clockwork, you need to add the following environment variable to your .env.local file:
CLOCKWORK_ENABLED=true MONOLOG_DEFAULT_CHANNEL=clockwork # To log to Clockwork
Chrome Extension
To view the collected data, you need to install the Clockwork Chrome extension. You can find it here: https://chromewebstore.google.com/detail/clockwork/dmggabnehkmmfmdffgajcflpdjlnoemp
Official Documentation
For more information, please refer to the official Clockwork documentation: https://underground.works/clockwork/
spiralle/clockwork 适用场景与选型建议
spiralle/clockwork 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 61 次下载、GitHub Stars 达 0, 最近一次更新时间为 2024 年 10 月 14 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 spiralle/clockwork 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 spiralle/clockwork 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 61
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 30
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-10-14

