Don't test constructors
Matthias Noback wrote down some good testing advice.
Read more [matthiasnoback.nl]
Matthias Noback wrote down some good testing advice.
Read more [matthiasnoback.nl]
Regular expressions are powerful, PHP but they are not known to be readable, and more often than not, maintaining a regular expression is not a straight-forward task. Here are some tips to improve and write better regular expressions in PHP.
Read more [php.watch]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Freek’s newsletter is one of the best ways to stay updated with the Laravel and PHP ecosystem. It consistently highlights useful packages, tools, and ideas from the community, especially the amazing work coming from Spatie. As a Laravel developer building SaaS and web platforms, I find it extremely helpful to discover practical tools and insights that improve my development workflow."
Mohamed shows how you can deal with N+1 problems using the $with model attribute and the newly added Model::preventLazyLoading() method.
Benjamin Eberlei tells the story of a performance mistake that is quickly made even by experienced developers.
Read more [tideways.com]
Most developers have probably seen some complex conditionals in legacy code. In this video I show you how to refactor those.
An excellent post on the subject by Sarah Dayan.
Read more [frontstuff.io]
You can make your code more readable by moving all your exception messages to dedicated classes. We using this technique in all our projects and packages.
Out of the box, Laravel comes with the ability to generate "signed" URLs. These URLs have a hash in their query string that verifies that the URL was not modified.
At Flare, we use these signed URLs to add action links in mail notifications. The action links allow users to snooze and resolve errors right from the mail without having to be logged in. Pretty convenient!
My buddy Dries Vints noticed a slight drawback. He got a mail from Flare that contains these action links. A few hours after the mail arrived, he clicked one of the action links. This is what he saw.
– dev.to - submitted by Patrick
Some best practices and tips for composing high quality pull requests when contributing to open source projects.
Read more [dev.to]
Let's dive into some of the design considerations you might make when designing abstractions that reach over a network.
Read more [blog.frankdejonge.nl]
I do want to point out that print debugging has one critical feature that most step-based debuggers don't have: you can see program state from multiple time steps all at once.
Read more [buttondown.email]
YouTube star Povilas Korop shares and discusses five rules from our guidelines.
– php.watch - submitted by Ayesh
Security precautions Composer already has, and what you can do to improve them further.
Read more [php.watch]
In this post, Dan Abramov shares two different techniques to optimize components without having to reach for memo().
Read more [overreacted.io]
This is how Seb decides when or when not to explicitly add types in TypeScript.
Read more [sebastiandedeyne.com]
In almost every Laravel package, there is a ServiceProvider class responsible for registering bindings package resources such as config files, views, migrations, ...
While preparing a workshop that I gave on package development, I watched some videos of our own Laravel package training video course again. While watching the videos on using the service provider again, I had the idea to simplify how resources can be registered.
Meanwhile, I've fleshed out the idea and release it as a new package called laravel-package-tools. In this blog post, I'd like to introduce the package to you.
My colleague Brent makes the case for targetting and uses the latest PHP version.
Read more [stitcher.io]
"When it feels safe to make changes to code, it’s not really legacy code any longer".
Read more [medium.com]