Improve Passing Booleans in PHP
Passing booleans to a method can be code smell, as it is not clear what a boolean does by reading the calling code.
In this section you can read posts I've written myself.
Passing booleans to a method can be code smell, as it is not clear what a boolean does by reading the calling code.
Using else often encourages complexer code structure, makes code less readable. In most cases you can refactor it using early returns.
Stay up to date with all things Laravel, PHP, and JavaScript.
You can follow me on these platforms:
On all these platforms, regularly share programming tips, and what I myself have learned in ongoing projects.
Every month I send out a newsletter containing lots of interesting stuff for the modern PHP developer.
Expect quick tips & tricks, interesting tutorials, opinions and packages. Because I work with Laravel every day there is an emphasis on that framework.
Rest assured that I will only use your email address to send you the newsletter and will not use it for any other purposes.
Original – by Brent Roose & Freek Van der Herten – 2 minute read
Have you ever needed to maintain a project that wasn't yours? A project that, when you first opened it, gave you chills down your spine? Even without reading the code in detail, you could already tell it was a mess.
In this stream on YouTube, Francisco Madeira, co-creator of Termwind, guides me through the source code of his amazing package to style content on the CLI
I'm proud to share that our team has launched a new CLI tool called GitHub Actions Watcher.
I'm proud to announce that our team has released a new package called spatie/laravel-route-discovery. This package can be used to automatically discover and register routes by looking at your controllers and views. Of course, you can also still register routes like you're used to in a routes file.
In this blog post, I'd like to tell you all about this package.
Our team has released a small package called spatie/laravel-slack-alerts. It can be used to send a message to Slack quickly. In this blog post, I'd like to share why we've created this package and how you can use it.
Ignition is the most beautiful error page for PHP apps. Yesterday, we launched a new major version of Ignition - you can check out all the details in this blog post.
Ignition used to be Laravel specific, but we've now created a framework agnostic version as well. Let's try using Ignition in a simple Symfony app.
I'm proud to share that our team has released a new major version of Ignition, the most beautiful error page for Laravel and PHP. It has been redesigned from the ground up. Here's how it looks like. This error page will be the default in Laravel 9. You can optionally install it into any Laravel 8 or…
Now that we are in the final days of 2021, let's take a look back at that stuff my team and I did in 2021.
Whenever I upgrade PHP, I seem to have troubles installing imagick. This command pecl install imagick always results in an error "'pcre2.h' file not found". To fix that error, you should issue these commands: brew install pcre2 ln -s /opt/homebrew/Cellar/pcre2/10.39/include/pcre2.h…
I'm proud to announce that we've released a new package called Laravel Health. As the name implies, this package can be used to monitor the health of your Laravel application.
It offers many checks out of the box, and an easy way to create custom checks. When something is wrong, you can get a notification, or view the status on a dashboard.
The package also offers deep integration with Oh Dear, allowing for even more robust monitoring
I want to tell you all about it in this blog post. Let's go!
I've used this little bash alias for many years to quickly run the tests inside of a project.
alias p="vendor/bin/phpunit"
With this alias in place, I can run the tests by typing "p" on the CLI. Nice!
For a long time, everything was great! But then, Pest appeared on the scene. It's an alternative test runner for PHP with a high focus on developer experience.
Earlier this week the PHP Foundation was announced. In this stream on GitHub, my buddies Christoph Rumpel, James Brooks and I discuss what we think this means for the future of PHP.
For years, my team and I manually updated the changelog for our 250+ packages. Recently, we've improved how we go about this.
In this blog post, I'd like to tell you all about it.
I am excited to share that my team and I have just launched v2.0 of our Laravel Package Training video course.
Here's a the introductory video for the course:
In your tests, you might have used assertDatabaseHas
to make sure that a model actual is persisted.
Here's the recording of the latest edition of the Laravel Worldwide meetup. Philo Hermans showed off two great Livewire packages that he made. Steve McDougall did a cool live coding session on how to build APIs. And at the end, our suprise guest Caneco gave a nice little presentation on Lumen as…
My current setup (end 2021 edition)
After tweeting out a screenshot, it often get questions around which editor, font or color scheme I'm using. Instead of replying to those questions individually I've decided to just write down the settings and apps that I'm using.
In the vast majority of applications you work with data structures. Sometimes that data is described multiple times. Think for instance of a form request that tries to validate a blog post model, and an API transformer class for that same blog post model. Changes are that both classes describe the same properties.
Using our new laravel-data package, those structures only need to be described once.