Hi, I'm Matthieu Napoli!

These and thoughts and experiments about web development and programming.

02 November 2017

My "speaker checklist"

I follow a checklist whenever I am planning to speak at a conference. I am sharing it so that hopefully it can help you too.

The steps marked with 💥 are the one I failed before and don’t want to fail again :) It also let me justify why something that sounds silly may be part of the list!

The checklist is quite long and might seem paranoid or more stressful than helpful, but it’s actually the contrary: the more you anticipate things, the less reasons you have to stress.

19 June 2017

Using non-breakable spaces in test method names

Yes. This article is about using non-breakable spaces to name tests. And the fact that it’s awesome. And why you should use them too.

public function test a user can add a product to a wishlist()
    // ...

The code above is valid PHP code and works. Non-breaking spaces (aka   in HTML) look like spaces in editors but are actually interpreted like any other character by PHP.

12 November 2015

Approaching coding style rationally

Let’s talk about how to format code and name things.

I remember when PSR-1 and PSR-2 became a thing. Jeez that “use only spaces” thing was just ridiculous, I knew that tabs where better (right?). And those crazy formatting rules were the opposite of what I was used to. Nonsense! One day I did the jump and after a few weeks, I just didn’t care anymore. I was over it, just like everyone else did, and PSR-2 was my new religion.

Fast forward a few years and I’m at a talk where the speaker argues to use snake case for naming test methods. Dude, you crazy? We just finally got consistent style across all the PHP world! And we all know that camelCase looks much better right? How can I go against PSR-2? It turns out, after trying it, that this was a wonderful idea…

Habits are sometimes making us blind. We think X looks prettier than Y but that’s just the habit speaking. In this article I’ll try to take a rational approach at coding style. That means leaving the “it looks ugly/better” at the door.

12 April 2015

Silly CLI 1.1 comes with dependency injection

I have just released Silly CLI 1.1 and I think it’s awesome, here’s why.

What is Silly?

If you missed it, Silly is a small project I started a month ago. The idea is simple: it is a CLI micro-framework.

Much like Silex or Slim let you create a web application in a single file using closures as controllers, Silly let you create a CLI application in a single file using closures as commands:

$app = new Silly\Application();

$app->command('greet [name] [--yell]', function ($name, $yell, $output) {
    $text = $name ? 'Hello '.$name : 'Hello';
    if ($yell) {
        $text = strtoupper($text);



21 September 2014

Decoupling packages

Decoupling packages is a hard thing. There are not a lot of options, and this blog post is about how some options are better than others.

Let’s say for example that you are writing a “package”, or library, to respond to HTTP requests (that kind of package could be considered the basis for a web framework). How do you handle routing?

If you write your Router package as an independent package (which is good: small and specialized packages are more reusable and maintainable), you might not want to couple the HTTP package to the Router package: you want to leave users free to choose the router of their choice.

So, what are your options to make the HTTP package and the Router package decoupled from each other?

01 July 2014

A retrospective on open sourcing projects at My C-Sense

Today is my last day at My C-Sense, after almost 2 years working on creating and modernizing existing PHP applications. This has been an incredibly rich experience in an excellent work environment, I will surely miss this job and my colleagues.

Now is probably a good time to look back on our open source experience as a company, and as a developer. It all started when we moved all of our code to GitHub: we used a lot of open source software and libraries, and we thought we might try to contribute some day with some small internal projects too.

So that’s how MyCLabs was born: let’s keep the door open for open source because “why not”.

27 March 2014

The Collection interface and Database abstraction

This article logically follows the previous: The Repository interface. In there I suggested a better interface for repositories based on a Collection interface so that repositories could be manipulated like collections.

This article goes further in that idea and presents an API to abstract database access behind collections of objects.

But first let’s start with Doctrine Criterias.