Skip to content

Blog

Page 5 of 76 - keep going...

Get the benefits of final classes in Rector

Rector is a powerful tool for automated code refactoring and upgrades. Among its many features, it can enforce coding standards and apply fixes across your entire codebase.

One setting I find particularly useful is ->withTreatClassesAsFinal(). When enabled, Rector analyzes your code as if all classes were declared final, even when they’re not.

Jan 15, 2026 1 min read #ide-and-web-dev-tools #php

Customize Laravel Ide Helper to Autocomplete Blade Files

I’m working with Yajra DataTables in a Laravel project and I’ve ran into a little bit of a headache. They provide their own render() method, which you pass a blade file to as the first parameter. Something like users.dogs.index - and through that mechanism it loads the proper blade for the datatable.

Here’s the problem, though. I can’t get auto complete and I can’t click through on that in PhpStorm. But I want to. Let’s find out how.

Dec 17, 2025 2 min read #laravel #phpstorm

PhpStorm Terminal LC_ALL Error Fix

When a new terminal opens in PhpStorm on macOS, I was getting a weird error: bash: warning: setlocale: LC_ALL: cannot change locale (en_US-u-hc-h12-u-ca-gregory-u-nu-latn): Invalid argument.. Strange, I use Oh My Zsh with the Zsh shell. Why am I getting that error? Why bash? I could ignore it each time - but I wanted a fix.

Dec 5, 2025 2 min read #macos #phpstorm #scripting

GitHub Workflow for Production Merge

GitHub actions are awesome. In fact, we often write about them or share details on MasteringLaravel.io in the tips section or the community.

Let’s take a look at one particular workflow that appears pretty simple - after you understand it all.

How do we merge from develop into main for a production deploy or merge? By using this GitHub action.

Nov 18, 2025 2 min read #git #github

Stopping Laravel SQL Injection with sole()

I love using Eloquent’s sole() method in Laravel. It throws an exception if the result set is ever more than 1. It means you should only have a sole record. This is usually what I want. I’ve migrated away from firstOrFail() unless I legitimately want the first of a matching set.

But I just found another reason to love using the sole method - it helps add a layer of protection against SQL injection. Let’s find out how.

Nov 7, 2025 2 min read #laravel #mysql #security #sql