explaingit

itsgoingd/clockwork

5,940PHPAudience · developerComplexity · 3/5Setup · moderate

TLDR

Clockwork is a PHP debugging tool that captures every request your app handles and shows you database queries, cache calls, events, and a performance timeline right inside your browser developer tools.

Mindmap

mindmap
  root((clockwork))
    What it captures
      Database queries
      Cache operations
      Redis commands
      Queued jobs
      Log messages
    Interfaces
      Chrome extension
      Firefox extension
      Built-in web UI
    Configuration
      Debug-mode only
      Slow request filter
      N+1 detection
    Audience
      PHP developers
      Backend engineers
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Find slow database queries or N+1 query problems in a Laravel app by viewing a visual timeline of every request.

USE CASE 2

Debug a PHP API consumed by a mobile client by opening Clockwork built-in web interface at /clockwork to inspect requests without a browser extension.

USE CASE 3

Profile which part of a PHP request takes the longest by wrapping code blocks with Clockwork timeline start and end markers.

Tech stack

PHPComposer

Getting it running

Difficulty · moderate Time to first run · 30min

Requires installing a companion browser extension or using the /clockwork web interface alongside the Composer package.

In plain English

Clockwork is a debugging and profiling tool for PHP applications that shows runtime information directly in a web browser. This repository contains the server-side component, installed via Composer and paired with a browser extension or a built-in web interface. When active, Clockwork collects data for every HTTP request the application handles, and optionally for artisan commands, queued jobs, and tests when those features are enabled in the config. The collected information includes request and response details, executed database queries with timing, cache operations, Redis commands, dispatched events, queued jobs, rendered views, log messages, and a visual performance timeline. A browser extension for Chrome and Firefox adds a Clockwork panel to the developer tools, while visiting /clockwork in the app opens a standalone interface that lists all recorded requests, which is useful when building an API consumed by a mobile client rather than a browser. By default Clockwork activates only when the app is in debug mode. The configuration file allows narrowing this further: collecting only when the browser extension is open, only for slow requests, only for error responses, or filtered by a custom condition. Config options also include a slow query threshold, detection of duplicate N+1 queries, and a limit on stored stack trace frames per log entry. Logging from application code is done through a clock() helper that accepts any value, including arrays and objects, and an optional log level. A timeline API lets developers mark the start and end of any code block so it appears as a colored bar in the visual timeline, making it straightforward to see where time is spent during a request.

Copy-paste prompts

Prompt 1
I'm using Clockwork in my Laravel app. Show me how to mark the start and end of a custom code block so it shows up as a colored bar in the performance timeline.
Prompt 2
How do I configure Clockwork to only collect data for slow requests above 500ms and to detect duplicate N+1 database queries?
Prompt 3
Set up Clockwork in a PHP API project so I can inspect requests using the built-in /clockwork web interface instead of a browser extension.
Prompt 4
Use Clockwork's clock() helper to log an array of debug values with a custom log level from inside a queued job.
Open on GitHub → Explain another repo

← itsgoingd on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.