Posts tagged with best practices
Authoring Great Pull Requests
– 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]
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.
"As a Laravel developer, this is the one newsletter I most look forward to. Freek has a talent for distilling packages or techniques down to something immediately useful - one tip can save you hours and even weeks. It's concise and practical and highly relevant."
Back the func off, this is my abstraction!
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]
The unreasonable effectiveness of print debugging
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]
Better Laravel / PHP Code: five guidelines from Spatie
YouTube star Povilas Korop shares and discusses five rules from our guidelines.
Composer Security Hardening
– php.watch - submitted by Ayesh
Security precautions Composer already has, and what you can do to improve them further.
Read more [php.watch]
Before You memo()
In this post, Dan Abramov shares two different techniques to optimize components without having to reach for memo().
Read more [overreacted.io]
When to add types and when to infer in TypeScript
This is how Seb decides when or when not to explicitly add types in TypeScript.
Read more [sebastiandedeyne.com]
Simplifying service providers in Laravel packages original
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.
A storm in a glass of water
My colleague Brent makes the case for targetting and uses the latest PHP version.
Read more [stitcher.io]
It’s not legacy code — it’s PHP
"When it feels safe to make changes to code, it’s not really legacy code any longer".
Read more [medium.com]
Stop duplicating your Eloquent query scopes and constraints. Re-use them as select statements with a new Laravel package.
– protone.media - submitted by Pascal Baljet
Introducing a new Laravel package that allows you to re-use scopes as a boolean attribute on Eloquent models.
Read more [protone.media]
Splitting a large Laravel Livewire Component
– www.csrhymes.com - submitted by Chris Rhymes
Splitting up a large Laravel Livewire component into more manageable and maintainable chunks
Read more [www.csrhymes.com]
Dealing with null
Here's an excerpt taken from Front Line PHP where different strategies to handle null are explained
Read more [front-line-php.com]
On Exactitude in Technical Debt
Technical debt is not simply a measure of the specific work needed to repay the debt; it is the additional time and effort added to all past, present, and future work that comes from having the debt in the first place.
Read more [www.oreilly.com]
Object oriented code done right
Here's an entire chapter taken from Front Line PHP, a course on building moderns apps with PHP 8
Read more [front-line-php.com]
Store strongly typed settings in a Laravel app original
We have released a new package, called spatie/laravel-settings, that allows you to strongly type settings in a Laravel app. In this blog post, I'd like to introduce the package to you.
Apply Filters Conditionally In Laravel With when()
– naxon.dev - submitted by Daniel Naxon
Ever needed to apply filters on a query conditionally, only when the user actually applies them? Laravel query builder's method when got you covered.
Read more [naxon.dev]
HTML Forms: Preventing Double Form Submissions
Here's how Bram Van Damme prevents double form submissions
Read more [www.bram.us]
Unconventional Laravel: Responsable Classes
– ryangjchandler.co.uk - submitted by Ryan Chandler
Sometimes your controllers can get rather large, especially if you have lots of conditions and data formatting. Have you ever considered moving some of that complexity out into a dedicated response class?
Read more [ryangjchandler.co.uk]