定制 spiralle/clockwork 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

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/

统计信息

  • 总下载量: 61
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-14