hi there, beautiful!

this is my special place on the internet. my website, my rules.

how to set explicitely set parameters as nullable with regex

The problem In PHP 8.4, implicit nullable types will be deprecated. This is an example of what would be considered deprecated in PHP 8.4: public function edit(object $item = null) {} Instead, that would now need an explicit nullable type: public function edit(?object $item = null) {} Fixing this with RegEx This requires a lot of code to update. Luckily, God gave us the magical gift of RegEx. Here is an expression that modifies your functions automagically:...

October 28, 2024 · 1 min

why you should create content.

As engineers, we write a lot of code. We also write a lot of other forms of content. There’s a good chance that you spend less time writing code than other forms of content on a daily basis. Other forms of content might include: Emails to colleagues about projects Comments and descriptions in Jira tickets Postmortems Code reviews Meeting summaries Why should I care? There’s a good chance you are now thinking: “See!...

June 30, 2024 · 4 min

using generators for processing data.

When processing large amounts of data in PHP, I see a lot of developers loading the entire dataset in memory. When reading a file, they will read the entire file with file and then process it. That’d look something like this: function processFile($filePath) { $lines = file($filePath, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES); foreach ($lines as $line) { processLine($line); } } $filePath = 'largefile.txt'; processFile($filePath); This has a very obvious disadvantage: it loads the entire file in memory....

May 21, 2024 · 2 min

how to speak your users' language.

So you have an application or website, and have decided to go support new markets, or even go fully global. Exciting! In this article, I will go into 5 things that I have seen developers (and others in tech!) do wrong. If you are one of them: don’t worry. Even the biggest companies and organisations do this wrong all the time! Because this isn’t necessarily an article for developers, I am not relying on code examples....

October 20, 2023 · 7 min

alt, aria-label, title: a11y the right way.

There are many ways to add data to an element that are not directly visible, each with a different purpose. I often see them used interchangeably, although they have distinct purposes and effects. This post attempts to shed some clarity on that landscape. Title This might come as a surprise to the experts, as it actually has no accessibility purpose. title is not intended for accessibility, and in many cases, it even works against it:...

October 19, 2023 · 2 min

what's new in php 8.3?

PHP is not what it used to be. Meanwhile, it is a language with a vibrant community and big (and small) changes that are making developers’ lives increasingly pleasant. At the end of this year, a number of changes will be added. PHP 8.3 will be released around November and we already know what most of the changes will look like. To make sure you can start working with the changes right on the release date, here is a preview....

June 29, 2023 · 6 min

rename your git blame.

By default, git has the git blame command to find out when a rule was modified and by whom. It is a very useful command, but its problem is that it gives the impression that someone is being blamed for something. This is why I, along with many others before me, advocate renaming git blame to a friendlier alternative. A number of suggestions have already been made in the past:...

January 20, 2023 · 1 min

there's a way to use github copilot with confidence.

GitHub Copilot has been part of our lives for a year now and has changed the way they work for many developers. This offers a whole host of opportunities, but of course also all kinds of risks. For instance, it generates a lot of code that we don’t always understand exactly what it does, and what the edge cases are. We can figure it out, and we should, of course. But there is another way that can help us gain confidence in how the code GitHub Copilot presents us with works....

October 8, 2022 · 4 min

making automatic backups to the cloud for free

There are many things you might want to make backups of. It could be of your code, of assets, or of your entire database. Whatever it is, backups will make sure you don’t lose them. In this blog post, we’ll look at making backups of your MySQL database. This technique can also be used to make backups of all kinds of other assets. What’s AWS S3? We will store our backups in AWS S3....

June 17, 2022 · 6 min

clean up your laravel routes.

When you create a new Laravel project, there is 1 route in your web.php: // file: web.php Route::get('/', function () { return view('welcome'); }); So you might assume that this is the best way to do it, but that is not necessarily the case. Replacing the closure with a controller method A neater way would be to replace the closure with a controller method. The implication, in fact, is that it can then be cached....

June 12, 2022 · 2 min