Olivier Laviale On building software for internet

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.

This pattern is particularly helpful to remove input concerns from the application business. Whether the input is an HTTP request, a […]

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, […]

A delayed event dispatcher

The olvlvl/delayed-event-dispatcher package provides an event dispatcher that delays event dispatching to a later time in the application life.

A delayed event dispatcher is useful to reduce the response time of your HTTP application when events can perfectly be dispatched after the response has been sent. For instance, updating an entity that would require clearing […]

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 a caching layer, than a whole repository. It will also help in making your application more maintainable […]

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!

I assume you're using symfony/dependency-injection. If not, you need to create […]

Modules can no longer be disabled at runtime

A lot has changed since I introduced modules in WdCore, the ancestor of ICanBoogie. Their initial implementation was inspired by their counterpart in Drupal 5, at a time where you would manually install the components of your application. With the advent of Composer and modern application deployment process, the ability to disable modules […]

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 […]

Binding Symfony's DIC to ICanBoogie

Although I really enjoy the concept of bindings implemented in ICanBoogie, I recognize it can be challenging when your application has thousands of dependencies. Also, as I'm implementing a message bus for ICanBoogie, I recognize the value of a dependency injection container to instantiate all the lovely message handlers, and because I really […]

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 […]

Caching template fragments

In my ever lasting quest to improve the response time of Icybee, I introduced a new markup that, with very little effort, caches rendered template fragments […]

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 […]

1 ms, 5 ms

Developing ICanBoogie, I always try my best to make it fast despite adding nicer and nicer features. I had very nice timings with PHP 5.6 but now with PHP 7 it's on another level. For instance, on this shared host (around 4€/month), it takes ICanBoogie 1ms to boot and 5 ms to return a […]

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 […]

Hinting prototype methods and properties

The Prototype package allows methods of classes using the PrototypeTrait to be defined at runtime; and since properties accessor are methods as well, this includes getters and setters.

Similar to interfaces, this feature allows classes to leave open implementation specifics. And since attributes (their getter) can be used to lazy load a resource, it also […]

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.

The blog is built on the controller/model/view/render foundation. Articles are available as Markdown files. They are converted into […]