Each Symfony Component has been available as a standalone "package" for a very long time, but this is the first time I post something about this on this blog. That's because the way it was done was quite experimental... until recently.

Why is it useful? Let's say you have a project that does not use Symfony, the full-stack framework, but you still want to rely on a few Symfony Components like YAML, Console, and Process for instance. In that case, instead of depending on the main symfony/symfony code, your project can just depend on these specific components. If you are using Git submodules, just reference the repositories found on Github. If you are using Composer, and you should, just reference the components you rely on in your composer.json file:

{
    "require": {
        "symfony/yaml": "2.1*",
        "symfony/console": "2.1*",
        "symfony/process": "2.1*"
    },
    "minimum-stability": "dev"
}

The code found in these standalone Git repositories is synchronized with the main code found in the official Symfony repository. It works by "splitting" the main repository into many small ones thanks to the new subtree Git command. But until now, the process was fuzzy at best and unfortunately not very reliable.

First, because we have many things to extract. As of today, we have more than 60 different splits: 30+ components/briges/bundles for two versions, 2.0 and master. But soon, we will have 90 differents ones as we will branch 2.1. And of course, the more commits we have, the longer the process is (the master branch has 10,000+ commits).

Then, because we don't use the subtree command in the canonical way. As we don't want to pollute the main repository with information about the split, we need to start over each time we split. And splitting the whole repository from scratch for the 60 different splits takes at least 7 hours.

Because of these issues, the splits were only updated from time to time (every French night at most). But two weeks ago, I took a whole day working on optimizing the process and I've integrated the split with the Github push hook mechanism so that we only split the components involved in a push.

The new version has been online for the last week and the Components are now updated 1 or 2 minutes after some changes are pushed to the Symfony component. Unfortunately, we have had one force push during that time due to a bug in the Git subtree command (I haven't found the time to submit a bug report yet).

The good news is that the Symfony component repositories are now updated in near real-time with the main Symfony repository.

Published in #Living on the edge