Olivier Laviale On building software for internet

Configure ICanBoogie with domain-specific type-safe builders

Starting with v6, ICanBoogie introduces a new approach to component configuration. While still using PHP files, the framework now employs type-safe domain-specific builders instead of arrays. Going further, some configurations can be inferred from PHP 8.0 attributes, moving configuration concerns closer to the code. These improvements aim to make the configuration process more reliable and […]

Quotes that inspired me in 2022

With two days left in 2022, now is as good a time as any to reflect on this past year. I went through my Twitter favorites to find quotes that inspired me or at least made me pause. I thought I'd share them with you […]

A convenient way to retrieve targets of PHP 8 attributes

I was looking for a convenient way to retrieve targets of PHP 8 attributes, so I could use them in my packages. I couldn't find any, so I wrote one that comes in the form of a Composer plugin […]

MessageBus v3.0 with permissions, voters, and a simplified API

ICanBoogie/MessageBus v3.0 provides an implementation of the message bus pattern, with support for permissions and voters. It comes with a simplified API, as the separation between "query" and "command" is gone […]

Improving My Deliveries, the most visited screen at HelloFresh

Millions of HelloFresh customers use My Deliveries weekly to select their upcoming meals and add-ons. The screen receives a lot of visits. Unfortunately, it also receives a lot of complaints, mainly related to loading issues. This article is about how I led a multi-team, cross-functional initiative to replace its most painful pain point to improve […]

My implementation of psr/event-dispatcher, PSR-14

Starting v5.3, Symfony's compiler pass to register event listeners and subscribers is no longer configurable, that is, we can no longer configure multiple event dispatchers, and we need to use Symfony's tags. I understand the need for simplification on Symfony's side, but none of this is practical for our projects that don't use the […]

Checklist for handing off a project

Whether a member leaves a team or a team inherits a project, knowledge transfer is required so that the new owners can continue with the project, and the previous owners can move on to something else. We want to minimize archaeology when the new owner wants to add an endpoint, add a command, deploy the […]

How we created a gateway filter to authorize requests without involving the API monolith

We have a few services that are only accessible through the API monolith because that's where we verify a customer owns a subscription. This article is about the solution we found to use these services without the API monolith […]

Generate locators from tagged services with Symfony 4.3

Symfony 4.3 introduced a new keyword to be used with its dependency injection container, that generates locators made from tagged services. It's easy to use and saves us from maintaining handwritten compiler passes and locator classes. Sadly, after a short announcement, there's little yet in the way of documentation, so I hope this […]

Paying technical debt and driving excellence with Chapter Days

It's not always easy for product owners and their team to prioritize technical initiatives over business ones, and in time documentation and dependencies are outdated, code is increasingly difficult to maintain, new joiners have a hard time getting started, knowledge is lost… At HelloFresh, Chapter Days help with all this and more. Maybe they […]

Build Docker images with PECL packages without using the PECL command

In a previous article I explained how to install PHP extensions from source for PEAR is no longer available starting PHP 7.4 and PECL is bundled with it. I think I found a simpler solution that works with PECL packages and still does not require the PECL command […]

Installing PHP extensions from source in your Dockerfile

Starting with PHP 7.4, PEAR is disabled by default, which means PECL is no longer available to install extensions. There's a number of reason to that decision, so we'll have to make do. It took me a few hours to update my Dockerfile and replace PECL calls with manual installations, that MongoDB one was […]

Redesigning the experimentation infrastructure at HelloFresh

HelloFresh is continuously refining the customer experience with the website or the mobile applications. We validate most of the changes we introduce using experimentation: changes are delivered to a portion of our customers, and are only delivered to more of them if the feedback is positive. Creating and maintaining these experiments has been a challenge […]

A journey to smaller menu payloads

At HelloFresh, My Deliveries is one of the screens our customers interact the most with. That's where they review what's coming up in the next weeks and select their recipes and add-ons. Unfortunately we were getting a lot of complaints about it, mostly related to loading times. While I was writing the menu service I […]

An alternative proxy generator for Symfony's dependency injection

In order to avoid instantiating services that might not be used, we use lazy services that get instantiated only when their proxy is interacted with. Symfony comes with a proxy generator, but it's kind of too much for what I need, and worst of all, it does not support final classes. Tired of writing handcrafted […]

Going controllerless

For our new service, I decided to split the command dispatcher to have a separate query dispatcher (CQS style), but then controller constructors started to look weird with these two dependencies, especially because for each request one of them would be useless. This is the story of how I extracted actions from their controller […]

Your application should not crash when cache is not available

After a year of good and loyal service the Redis instance used by my service went down—rebooted by AWS for some unknown reason—making the service inoperative for about 30 minutes. A situation that could have been avoided if the service was resilient to cache unavailability […]

The command dispatcher pattern

The command dispatcher pattern serves to decouple the implementation of a command from its commander. The commander doesn't need to know how the execution of the command is implemented, only that the command exists […]

Queries, commands, and response caching

Most of the requests received by our services are queries, and most of these queries are the same. For each request we need to query the database and transform the data for presentation, a lot of work which could be avoided by caching the response. If you developed your service with something resembling CQS, […]

How I implemented a cache layer, failed, then succeeded (also metrics)

After I extracted queries for active menus it was time to decorate them with a cache layer that would speed up indexing batches of recipes. Alas, comparing metrics I quickly realized that something was going wrong […]

Extracting queries from your repository

As your application grows, the methods of your repositories start to accumulate. The more methods, the harder it gets to decorate them with additional features. Looking at these methods you might find topics that will help you extract sets of them into cute queries. It's easier to decorate a class with three methods to add […]

Lazy loading commands with symfony/console v3.4

A long awaited feature has finally landed in symfony/console 3.4.x-dev: the ability to lazy load commands. There's an article about it on Symfony's blog, but it does not explain how to setup everything. It's not very complex so here we go! […]

Autoconfig extensions

Autoconfig is a feature of ICanBoogie that automatically generates a single configuration file from various sources to bootstrap the application. Extensions can participate in that process to provide additional features […]

A simple message bus

icanboogie/message-bus provides a very simple message bus that can handle messages right away or push them in a queue. Implemented with a functional approach, it tries to be as flexible as possible: the message handler provider and the message pusher are defined with simple callables that you can implement with your favorite resolver and your […]

A tale of proper naming

This afternoon, I was reviewing a colleague's PR and commented that his RecipesCollection should be a RecipeCollection because "a collection of records" is "a record collection". Surprisingly, I never questioned similar classes, such as repositories, in our application. For instance, we have a CuisinesRepository, which was fine by me a few days back while […]

ICanBoogie/CLDR v1.8 – Units

I just released ICanBoogie/CLDR v1.8 with support for units, another part of number formatting. Quantities of units such as years, months, days, hours, minutes and seconds can be formatted— for example, in English, "1 day" or "3 days" […]

ICanBoogie/CLDR v1.7 – Plurals

I just released ICanBoogie/CLDR v1.7 with support for plurals. A lot of work to find what pluralization rules a language use, or what pluralization rule should be applied to format a number. You see, depending on the language the rules may vary, some languages such English or French pluralize anything that is not or 1 […]

Using APC with Travis-CI

It's not easy getting APC to work on Travis-CI, every now and then something is updated and your clever solution is broken again. What's super annoying is that you cannot even trust the documentation. Right now it says that APC is available for PHP 7, but when you try to activate the extension […]

Collecting and displaying localized error messages

After three years of relative quietness, I'm about to release v2.0 of my error collector package ICanBoogie/Errors; because after working on my validation package ICanBoogie/Validate, and trying my best to implement it in Brickrouge in the most uncoupled way possible, it was clear to me that the decisions I made regarding error instances […]

Loading style sheet and JavaScript assets using promises

In my quest to a framework agnostic Brickrouge, and a replacement for MooTools's Utilities.Assets, I entered the new and exiting territory of ECMAScript 6 and its promises, and I'm never looking back! NEVER! […]

ICanBoogie/HTTP v2.7

So far, the revision v2.7 of ICanBoogie/HTTP comes with the following changes: safe and idempotent requests are supported with the is_safe and is_idempotent properties; the request context now implements ArrayAccess; the transform_params() method returns flatten and/or normalized request parameters […]

Use constants as array keys

When strings are used as array keys there is no difference between the key used to define the identifier of a route and that of a record. It may become quite troublesome when you need to search for common keys such as id, name, or title; for instance when you need to […]

A new hope

It started as an exercise to try out the features implemented in ICanBoogie v3.0, without the comfort of Icybee. Something that would allow me to discover areas of improvement by trying different approaches and test limits […]