clockwork is a free, open source monitoring & observability project written in PHP and released under MIT. It has 5,950 GitHub stars, 333 forks and 39 open issues, and was last pushed 20 days ago. On this registry it ranks #69 of 97 tracked projects in Monitoring & Observability, with 5 head-to-head comparisons available. It gained 1 stars over the last 3 tracked days.

What is clockwork?

Clockwork is a development tool for PHP that gives developers an insight into their application runtime — including request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs and rendered views — right in the browser, and this repository contains its server-side component.

What it is

Clockwork is a PHP development tool that lives in the Laravel ecosystem and collects runtime data from an application so developers can inspect it from a browser interface, a browser dev tools extension, or an in-application toolbar. The server-side component in this repository does the collecting and storing; the viewing side is provided by the /clockwork route, by the Chrome and Firefox extensions, or by the optional client-side toolbar. It collects the same kind of data across several execution contexts — HTTP requests, console commands, queue jobs and tests — rather than only for browser-initiated page loads.

The concrete problem it solves is the absence of a unified, in-browser record of what an application actually did during a request or job. Instead of scattering temporary logging statements to trace slow database queries, duplicate (N+1) queries, dispatched events or queued jobs, developers install a single library and read the collected data in a dedicated interface. It replaces ad-hoc debug output and per-request log spelunking with structured, browsable runtime insight, and it adds a clock() helper for inline variable logging without altering control flow.

Key capabilities

  • Collects request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs and rendered views for HTTP requests, commands, queue jobs and tests.
  • Collects artisan commands, queue jobs and tests since Clockwork 4.1; this requires enabling in the config file.
  • Runs only when the application is in debug mode by default, with options to explicitly enable or disable it, or to always collect data without exposing it for further analysis.
  • Offers selective request collection: on-demand mode collects only when the Clockwork app is open, errors-only mode records only 4xx and 5xx responses, and slow-only mode collects only responses above a configured slow threshold; a custom closure can filter requests. CORS pre-flight requests are not collected by default.
  • Supports a slow query threshold and detection of duplicate (N+1) queries for database query collection.
  • Collects stack traces for data such as log messages and database queries, with the last 10 frames captured by default and a configurable or disableable frame limit.
  • Provides the clock() helper, which returns its first argument so inline debugging statements can wrap values directly, plus a long-form clock()->info() call for specifying a log level, and a fluent timeline API for tracking events with a description, start and finish.

Who uses it and how

  • Laravel developers debugging a local or staging application who want request data, query timings, logs and events in one view rather than in scattered output.
  • Teams building APIs consumed by mobile applications, who use the /clockwork web interface because requests do not originate from a browser.
  • Developers profiling queue jobs, console commands and tests, who enable those contexts in the config file and inspect the collected runs afterwards.
  • Teams needing occasional visibility into non-debug environments, who use on-demand collection combined with a secret set in the app settings, or restrict recording to errors-only or slow-only traffic.
  • Developers who prefer dev tools integration, using the Chrome Web Store or Firefox Addons extensions, or who install the small JavaScript library needed for the client-side rendered toolbar.

Getting started

Install the library with Composer using composer require itsgoingd/clockwork. To enable additional features such as command and queue job profiling, publish the configuration file via the vendor:publish Artisan command, and refresh the route cache with the route:cache Artisan command if the Laravel route cache is in use.

How it compares

The facts provided do not name any paid products that Clockwork replaces, and they do not name comparable tools either. On the evidence in this registry, it stands alone in its category.

When to use it — and when not to

A self-hoster must run a PHP application, install the library through Composer, and decide on configuration — collection mode, filters, slow thresholds, stack trace limits — by publishing and editing the config file. Viewing the collected data also requires a second piece: the /clockwork route, a Chrome or Firefox extension, or the toolbar's JavaScript library, so installing the server-side component alone is not the whole story. Developers who do not use Laravel, or who want an all-in-one tool with no separate viewing client, should look elsewhere; the README here is deliberately brief and defers full installation instructions to the Clockwork website, so expect to consult external documentation rather than the repository itself.

project readme (upstream, from github) — read inline

Clockwork is a development tool for PHP available right in your browser. Clockwork gives you an insight into your application runtime - including request data, performance metrics, log entries, database queries, cache queries, redis commands, dispatched events, queued jobs, rendered views and more - for HTTP requests, commands, queue jobs and tests.

This repository contains the server-side component of Clockwork.

Check out on the Clockwork website for details.

Installation

Install the Clockwork library via Composer.

composer require itsgoingd/clockwork

Congratulations, you are done! To enable more features like commands or queue jobs profiling, publish the configuration file via the vendor:publish Artisan command.

Note: If you are using the Laravel route cache, you will need to refresh it using the route:cache Artisan command.

Read full installation instructions on the Clockwork website.

Features

Collecting data

The Clockwork server-side component collects and stores data about your application.

Clockwork is only active when your app is in debug mode by default. You can choose to explicitly enable or disable Clockwork, or even set Clockwork to always collect data without exposing them for further analysis.

We collect a whole bunch of useful data by default, but you can enable more features or disable features you don't need in the config file.

Some features might allow for advanced options, eg. for database queries you can set a slow query threshold or enable detecting of duplicate (N+1) queries. Check out the config file to see all what Clockwork can do.

There are several options that allow you to choose for which requests Clockwork is active.

On-demand mode will collect data only when Clockwork app is open. You can even specify a secret to be set in the app settings to collect request. Errors only will record only requests ending with 4xx and 5xx responses. Slow only will collect only requests with responses above the set slow threshold. You can also filter the collected and recorded requests by a custom closure. CORS pre-flight requests will not be collected by default.

New in Clockwork 4.1, artisan commands, queue jobs and tests can now also be collected, you need to enable this in the config file.

Clockwork also collects stack traces for data like log messages or database queries. Last 10 frames of the trace are collected by default. You can change the frames limit or disable this feature in the configuration file.

Viewing data
Web interface

Visit /clockwork route to view and interact with the collected data.

The app will show all executed requests, which is useful when the request is not made by browser, but for example a mobile application you are developing an API for.

Browser extension

A browser dev tools extension is also available for Chrome and Firefox:

Toolbar

Clockwork now gives you an option to show basic request information in the form of a toolbar in your app.

The toolbar is fully rendered client-side and requires installing a tiny javascript library.

Learn more on the Clockwork website.

Logging

You can log any variable via the clock() helper, from a simple string to an array or object, even multiple values:

clock(User::first(), auth()->user(), $username)

The clock() helper function returns it's first argument, so you can easily add inline debugging statements to your code:

User::create(clock($request->all()))

If you want to specify a log level, you can use the long-form call:

clock()->info("User {$username} logged in!")
Timeline

Timeline gives you a visual representation of your application runtime.

To add an event to the timeline - start it with a description, execute the tracked code and finish the event. A fluent api is available to further configure the event.

// using timeline api with begin/end and fluent configuration
clock()->event('Importing tweets')->color('purple')->begin();
    ...
clock()->event('Importing tweets')->end();

Alternatively you can execute the tracked code block as a closure. You can also choose to use an array based configuration instead of the fluent api.

// using timeline api with run and array-based configuration
clock()->event('Updating cache', [ 'color' => 'green' ])->run(function () {
    ...
});

Read more about available features on the Clockwork website.

Frequently asked questions

Is clockwork free to use?

clockwork is open source under the MIT licence. There is no licence fee and no seat count — you can self-host it or, where the project offers one, pay a vendor for a managed version instead.

What does clockwork do?

Clockwork - php dev tools in your browser - server-side component

What is clockwork written in?

clockwork is primarily written in PHP. Its source is publicly available at https://github.com/itsgoingd/clockwork, and it has 5,950 GitHub stars.