Creating and updating Symfony projects much faster

A few years ago, we introduced the Symfony Installer as the fastest way to create new Symfony projects. While Composer took up to several minutes to create a new project, Symfony Installer did the same in less than ten seconds.

The trick was that the installer downloaded a ZIP archive with all the dependencies required by the specific Symfony version you were installing, so it was not necessary that Composer resolved the project dependencies.

However, with the release of Symfony 4 we deprecated the Symfony Installer in favor of Composer, because we wanted to use standard development tools as much as possible. Sadly this made creating new Symfony projects slower and, in some cases, it triggered "out of memory" exceptions while Composer was resolving the dependencies.

Making installation via Composer faster

During the past months we've worked hard to improve the performance of Symfony Flex, the package used to create and manage Symfony apps. A few days ago, we made the two biggest improvements ever:

  1. The two skeletons used to create new Symfony projects, symfony/skeleton (for small apps, APIs, microservices, etc.) and symfony/website-skeleton (for traditional web applications) now include a composer.lock file to avoid Composer's dependency resolving (see symfony/skeleton #66 and symfony/web-skeleton #11). An automatic process ensures that those composer.lock files are updated whenever a dependency has a new version.
  2. Symfony Flex removes all the legacy Composer tags from all Symfony components before creating the project. This removes hundreds of unused tags and saves Composer hundreds of thousands of unnecessary checks.

Benchmarks

Thanks to these changes, creating new Symfony projects is between 60% and 90% faster and updating existing projects is up to 50% faster. Actual results may vary depending on your Composer cache, the size of your project and the speed of your Internet connection.

Creating new projects

1
2
3
4
5
6
7
$ composer create-project symfony/skeleton
  # BEFORE: 25 seconds / 395 MB
  # AFTER:  10 seconds / 142 MB

$ composer create-project symfony/website-skeleton
  # BEFORE: 3 minutes 32 seconds / 766 MB
  # AFTER:            21 seconds / 144 MB

Updating existing projects

1
2
3
$ composer update
  # BEFORE: 1 minute 10 seconds / 346 MB
  # AFTER:           33 seconds / 188 MB

Comments

Nice. Thx for this!
nitpicking: s/micorservices/microservices/
@bugmenot fixed! Thank you.
...and for faster upgrades, these is Rector: https://github.com/rectorphp/rector

Comments are closed.

To ensure that comments stay relevant, they are closed for old posts.