Blog post latest

  • Refactoring my Laravel Project

    My website has been on Laravel for a while and it has grown a lot over the last year. There weren't (m)any tests nor did the codebase have any static analysis or code style restrictions. Whi…

  • Short URL String Helper for Laravel

    In a recent project, I wanted to add some string helper methods. Laravel already provides a long list of string helper methods but they didn't cover what I wanted. These string methods can a…

  • Lesser-Known Composer Commands

    Composer is the tool PHP developers use to manage their dependencies. Most of the time a composer.json is set up at the start of a project and then forgotten about. I often run the composer…

  • Do Not Render a Laravel Component

    There have been many times when I was building a Laravel View Component and only wanted to render the HTML based on some logic. In the past, I added a Blade @if block to the actual component…

  • Using the Laravel Active Trait

    In a previous blog post, I wrote how I build traits for using in Laravel. This post discusses how you can use the trait in your Eloquent models. It covers how you actually use them, using th…

  • Laravel Active Trait

    When adding functionality that might be applied in multiple places, you might consider a way to reuse the code. You can either make all your classes extend a base class using inheritance or…

  • Time Travelling Dudes

    I am really happy with these trilogy triptych prints from Nick Chambers. They are titled “Time Travelling Dudes” and you can hopefully guess which characters the simplified lines are depicti…

  • Movies in January 2023

    It's a new year, so here is my January movie review. Overall, I watched 24 new movies this month and every movie was released in 2022. I caught up on some fantastic movies and some hard-hitt…

  • Testing Laravel’s Invokable Rules with PHPUnit

    I have previously been writing custom Laravel validation rules with explicit passes() and message() methods. However, since Laravel 9, the preferred method is now a little different. The doc…

  • addIf for Laravel Collections

    I wanted to add an item to a Laravel Collection, based on a truthy condition. In the script, I quickly jumped for the basic if syntax, but then wondered if there was a nicer way. if ($condit…