Know your dependencies' licenses
Your project pulls in dozens of dependencies. Each one has a license. Do you actually know what you’re shipping?
Page 6 of 77 - keep going...
Your project pulls in dozens of dependencies. Each one has a license. Do you actually know what you’re shipping?
I have npm installed globally on my machine.
But in some projects, I have a local ./npm script that wraps docker exec to run npm inside a container.
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.
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.
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.
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.
For a project I’m working on, I had to become very familiar with the print CSS styles for headers and footers. The goal is two fold: 1) to have a nice printable version and 2) to use a chrome-pdf tool to download as PDF.
Regardless of the two consuming sources, I just wanted to solve this all as one html/css file. So, it was necessary to explore all of the different options we have now, in 2025, on Chrome.
In this blog entry, see print (pdf) versions of the different header/footer functionality in CSS including built-in page margin and header/footer tools as well as fixed/forced hacks.
There are many ways to handle cascading functionality in Laravel. You can do this with observers, events, manually dispatched jobs - even in MySQL with cascading deletes.
I prefer to keep my cascading logic in the application code by using Eloquent Model Events. This is super easy when it’s just a single level of model. But what about relationships?
A common security pattern is to add environment-specific configuration and secrets into a local, unversioned file. You’re probably already doing this with a tool called DotEnv. Let’s see how we can reuse that between PHP and the shell.
Docker provides the HEALTHCHECK instruction for Dockerfiles and Docker Compose files.
While not absolutely required, configuring these can make your IDE and environment more robust and verbose.
Here’s what I use with some common containers in Laravel projects.