Datadog collects and monitors your PHP app metrics and distributed traces in real-time with application performance monitoring. Decrease downtime and performance issues with Datadog APM by tracing requests across service boundaries and drilling into individual traces end-to-end with flame graphs. Start your 14-day trial for free today.

Adding try/catch to Laravel collections

Original – by Freek Van der Herten – 6 minute read

A few weeks ago, Jmac tweeted out an excellent idea. What if we could use try and catch in a collection chain?

Meanwhile, Jmac and I did a few code pairing sessions to work on a possible implementation. We've added try and catch methods to the laravel-collection-macros package.

In this blog post, I'd like to share what you can do with these methods and how they work under the hood.

Read more

Stay up to date with all things Laravel, PHP, and JavaScript.

Follow me on Twitter. I regularly tweet out programming tips, and what I myself have learned in ongoing projects.

Every two weeks I send out a newsletter containing lots of interesting stuff for the modern PHP developer.

Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.

Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.

A package to schedule Artisan commands at sub-minute frequencies

Original – by Freek Van der Herten – 3 minute read

Laravel's native scheduler allows you to schedule Artisan commands to run every minute. For a project I'm working on I needed to schedule a command to run every few seconds. I found a good solution to do this using an ReactPHP powered event loop. Because this solution could be helpful for others as well, I decided to package it up.

Using the laravel-short-schedule package, you can schedule artisan commands to run every second or even lower frequencies. In this blogpost I'd like to introduce the package.

Read more

Improving readability by decreasing indentation

Original – by Freek Van der Herten – 1 minute read

Readability of code can be vastly improved by decreasing indentation. In this video we'll reverse conditions and early returns to accomplish this. If you want to see more videos like this one, head over to the video section at Spatie.

Read more

How to generate and view code coverage reports in PhpStorm using PHPUnit and Xdebug

Link –

In this video, you'll learn how to generate code coverage reports, and how to display them directly in PhpStorm.

This video is part of our Laravel Package Training video course. In that course, you'll learn how to create both framework agnostic and Laravel specific packages. We'll also source dive some popular Spatie packages together, so you can pick up some tricks we apply there.

Read more

Learn how to create PHP and Laravel packages using our new premium video course

Original – by Freek Van der Herten – 4 minute read

Together with my colleagues at Spatie, we have produced over 200 packages with more than 75 million downloads in total.

We learned a lot by quality packages like laravel-permission, laravel-backup, browsershot, laravel-medialibrary, and many more. We feel we have a pretty good workflow to produce reliable, readable, and maintainable packages.

We want to share the knowledge we have built up over the year with you in our new premium video course, titled Laravel Package Training.

Read more