Writing readable PHP: decrease indentation by returning early original
In this short post, I'd like to give you a tip on writing readable PHP.
In this short post, I'd like to give you a tip on writing readable PHP.
In an awesome series of video tweets, Mohammed Said explains some of the most confusing Queue configuration keys.
Read more [divinglaravel.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.
"Always fresh, useful tips and articles. Carefully selected community content. My favorite newsletter, which I look forward to every time."
PHP 8’s Just In Time compiler is implemented as part of the Opcache extension and aims to compile some Opcodes into CPU instructions in runtime. Nickolas Da Silva explains how it works.
Read more [thephp.website]
Christopher Pitt guides you can host daemon apps, for example Next apps, on Forge
Read more [assertchris.io]
Leonel Elimpe explains how you can use our DTO package.
Read more [github.com]
Recently we started using GitHub Actions to test all our packages. You can read more about our general setup in this blog post.
For most of the packages, this works great. However, some of our packages, such as Laravel Tags, use JSON functions that are not available in SQLite. Luckily it's straightforward to use a database like MySQL in GitHub Actions.
On the Oh Dear blog, Mattias Geniar shares how he found all certificates that were affected by Let's Encrypt mass revocation of SSL certificates.
Read more [ohdear.app]
Atymic explains a cool new feature in Laravel 7
Read more [atymic.dev]
– stefanzweifel.io - submitted by Stefan Zweifel
Stefan Zweifel recently had to refactor an Excel export which deals with thousands of rows. Lazy Collections helped solve all performance problems.
Read more [stefanzweifel.io]
– driesvints.com - submitted by Dries Vints
Dries Vints wrote a short piece on setting up a continuous delivery pipeline with Github Actions.
Read more [driesvints.com]
A nice example by Evert Pot on how you can make static analysers do their work better.
Read more [evertpot.com]
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.
– tighten.co - submitted by Matt Stauffer
When getting an open source pull request, sometimes you'll need to make a change before merging. Here's how to do that.
Read more [tighten.co]
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
laravel-tail is one of my favourite packages. When installed in a Laravel app it can be used to tail the log file. To tail a log file locally, you just have to issue this command: php artisan tail and it'll start tailing the latest log file (so it works for both daily and single log files). Any line…
In this short post, I'd like to share how I use BetterTouchTool in my daily work.
Sebastian Bergmann, creator of PHPUnit, walks us through some history and design decisions for PHPUnit.
Read more [thephp.cc]
Our spatie/laravel-event-sourcing package is probably the best starting point for event sourcing in Laravel. It has excellent docs, that explain event sourcing from scratch, support for aggregates, projectors, and much more! It's all beautifully integrated in Laravel.
Recently we released v3 of the package. In this blogpost I'd like to walk you through the changes.
Our team released a new package called spatie/ssh. This package allows you to execute commands via an SSH connection.