Setting up a global .gitignore file
My colleague Seb explains why and how you should use a global .gitignore file
Read more [sebastiandedeyne.com]
Posts tagged with best practices
My colleague Seb explains why and how you should use a global .gitignore file
Read more [sebastiandedeyne.com]
Seb explains why it's perfectly safe to drop a major version of PHP without tagging a new major version of a package.
Read more [sebastiandedeyne.com]
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."
In this short post, I'd like to give you a tip on writing readable PHP.
In this video, which is part of the mailcoach video course, I show how I like to write my exceptions.
At the time of writing this post, we're running a contest where you can win a free mailcoach license.
Have you every come across confusing if statements with complex conditionals such as this? I bet you did!
// please kill me 🤯 if (!(($this->shipping_country == "GB" || (strcmp($this-status, "Valid") !== 0)) {
To me, this is completely unreadable.
In the video below I show how I deal with this situation. Spoiler: add some tests around it and break the conditionals apart.
This video is part of the Mailcoach video course. It contains many more videos on how to write clear code. You can use this coupon code to get a nice discount of $10.
YES-I-WANT-TO-WRITE-READABLE-CODE
Here's how to let password managers recognise your login form and let you use their features on your fields.
Read more [hiddedevries.nl]
Mattias Verraes explains a method for making technical debt visible and negotiable.
Read more [verraes.net]
– tighten.co - submitted by Matt Stauffer
In the age of internet tracking, more users are turning to blocker software for protection. Sara Bin shares some tips to improve your website's UX for these users—and everyone else!
Read more [tighten.co]
– stefanbauer.me - submitted by Stefan Bauer
This article is the result of my 8 years of experience with PhpStorm and my best settings that make you a faster developer and let you focus more on the important things.
Read more [stefanbauer.me]
Jonathan Reinink wrote another excellent blog post.
As much as possible, keep data fetching to the perimeter of your Laravel applications. What do I mean by this? In the simplest terms, it means running your database queries in your controllers.
Read more [reinink.ca]
Sara Soueidan shares valueable insights on the importance of accessibility.
A few years ago I didn’t know what the term “accessibility” meant. I built Web sites that were partially inaccessible because I didn’t know better. Fast forward to today, I know enough to be able to write, speak and run workshops on accessibility, helping others build more a accessible and inclusive Web. Much like everyone else in our field, I am still learning. But since I started, I learned a lot of valuable lessons and core values that drive my work today. Here are a few of them.
Read more [www.24a11y.com]
– dev.to
David Khourshid explains how you can use state machines to make your logic more resilient.
Disabling a button is not logic. Rather, it is a sign that logic is fragile and bug-prone. In my opinion, disabling a button should only be a visual cue to the user that clicking the button will have no effect.
Read more [dev.to]
JMac, the creator of Laravel Shift, has a few interesting ideas on how to make the framework better.
Every so often a revolutionary change is required. This provides a chance to revisit goals. One of the primary goals of Laravel is developer experience. And maintainability, freshness, and approachability all improve developer experience. So, with all this in mind here are the top five things I would change in Laravel.
Read more [jasonmccreary.me]
Kevlin Henney wrote a good post on the importance of naming things well.
Good naming is part of design. It sets expectations and communicates a model, showing how something should be understood and used. If you mean to tell the reader getMillisSince1970, don’t say getTime.
Read more [medium.com]
In this small blog post, I'd like to give you a couple of tips to make your Artisan commands better.
At Laracon AU, Jason McCreary gave an excellen talk on how to create maintainable Laravel apps. On his blog he published a written down version of the talk.
Being the author of BaseCode and creator of Shift gives me a unique insight into writing Laravel applications. I combined 20 years of writing code with supporting over 20,000 Laravel upgrades into 10 tips for crafting maintainable Laravel applications.
Read more [jasonmccreary.me]
My colleague Seb lists a few very good actionale tips that help you maintaining open source software.
In the 4.5 years I’ve been a developer at Spatie, over 200 packages have been built and released by our team. I’ve done quite some authoring and maintenance over the years, and I’d like to share 8 actionable tips on writing and maintaining open source software without going insane.
Read more [sebastiandedeyne.com]
Tim MacDonald shares an interesting technique.
Action scopes are...well...just query scopes really, but instead of filtering they take an action. It's just a random name I've given them to differentiate them from regular filtering based query scopes in my projects.
Read more [timacdonald.me]
Not adding an API until absolutely necessary lets us keep our model internal and lets us iterate as needed.
— Matthieu Napoli (@matthieunapoli) October 10, 2019
Read more [twitter.com]
When the void typehint was introduced in PHP 7.1. There was some debate about it. Some people wondered if it is beneficial to type nothing? I was one of them. Meanwhile, I changed my opinion on it. In this short post, I'd like to give you a small example where I think void shines.