Clockwork For Laravel

Image Credit: https://underground.works/clockwork

Debugging is that time of the application development cycle which takes a lot of time, if you haven’t worked on that project. But Laravel, for that matter, always has a package for everything you might ever need.

So there’s one for debugging as well*

The package I am referring over here is called Clockwork and could be found over here : Clockwork.

How to Install?

Any package that exists for laravel framework could be installed using famous dependency manager composer.

So using composer:

composer require itsgoingd/clockwork

The above command will install the latest stable version of clockwork package for your laravel installation.

Now, if you are using Laravel 5.5, you might be aware of its package discovery feature which automatically detects package’s service provider and registers it for you.

But, if you are not, you have to register the provider manually.

You can do it by adding this line :

Clockwork\Support\Laravel\ClockworkServiceProvider::class

into your providers array in config/app.php file in your laravel installation.

How do you see it working?

You can do this by installing extension for Chrome or the addon for Firefox.

Now just restart the browser (Most of the times you don’t have to restart, do this only if you don’t see a tab in your developer tools named as “clockwork”).

Now if you load your application and open your developer tools in browser then for every page in your application you would see what route is called and what controller handles that request.

Additionally you get to know what views are loaded, what do we have in session, and most importantly how many database queries are getting executed and what line of which file is executing those queries.

It’s like every possibility is opened up for you. It’s just a matter of time, how you use this power that’s given to you, because it surely helps me save a ton of time debugging someone else’s code and I am thankful for that.

Tell me how you use this package, if you have already. Or if you are newly getting introduced to this marvelous tool, then tell me your experience.

Don’t forget to clap for this article if you gained something. And share if you care about other developers in the community.

And always love OpenSource.