This is what you can do with clockwork

As developer we need debugging and profiling tools ... Clockwork is one of this tools , go ahead and try !

1 minute

This is what you can do with clockwork

What is clockwork ?

As stated on The clockwork github repo , 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.

It's as simple as it gets , you install it via composer , install the browser extension, and you are set , for free.

Log to a dedicated window

With clockwork it is possible and super easy to log messages to a dedicated tab in your developer tools

clock('This is a log message');

the output of the clock command in the log tab of clockwork

Performance issues

it is possible to log to the performance issues tab

clock()->info("This is a performance issue", ['performance' => _true_]);

This log is visible in the issues section of the performance tab

Measure performance

With clockwork it is very easy to measure the time it takes to execute some code

clock()->event('Sleeping for two seconds')->color('purple')->begin(); sleep(2); clock()->event('Done sleeping')->end();

the measurement is shown in the timeline section of the performance tab

Show your database queries

With clockwork it is very easy to visualize your database queries and the time it takes to execute your queries against your database.

Every query will be logged to the database tab. It shows your total query time and the time per individual query.

Clockwork points to your controller

It's often not so clear which controller method a route is pointing to , with clockwork this is clear visualised on the left hand side of the toolset.

Create custom tabs

It's possible to create custom tabs and put the info in it you want, creating your own datasets in clockwork.

$cart = clock()->userData('Statistics')->title('Statistics'); $cart->counters([ 'Number of users' => 10, 'Number of orders' => 50, ]);

this article has been read 15 times