I had the privilege of hosting Jordi Boggiano, one of more important people in the PHP and Symfony communities. He showed his importance to the community a few days ago. Read on.
One line of code that speeded the "composer update" script up by 50-90% made people go crazy on the commit page - watch out, it might kill your browser :)
This incident is a nice proof of why Composer (and Jordi as one of the two main contributors) is so important - it’s used widely across the PHP landscape for dependency management. Together with Packagist (which is also Jordi's project), Composer became the default choice for many PHP projects. It is used by Symfony and, consequently, eZ Publish. Since eZ version 5.3 legacy extensions have also been managed by Composer, so only one dependency manager is used.
Take 30 minutes of your time and get to know Jordi and Composer:
For those who can't, here are a few takeaways:
- the above-mentioned performance improvement was gained by disabling GC. The idea for that started here. It is important to note that disabling GC helped in this case because Composer is not a usual PHP script, but one where GC was not behaving very well. So don't go and disable it in your code - inform yourself before you do that. Jordi recommends learning more about the GC
- although the algorithmic part of the update process was improved, there are still parts where performance could be improved even more. Mainly, network is the bottleneck and there is a solution for that developed by Jordi, check it out
- there are some dirty tricks that you can do if really necessary, one if it being version aliases, check it here
- there are more than 45000 packages on Packagist that can be simply declared as a dependency in your PHP project and installed via Composer
- for beginners - there are 2 main commands that you do with Composer:
- composer update (to calculate the dependencies, create a list of versions for all packages within the .lock file and installing all packages to vendor folder), used in development and upgrading situations
- composer install (to just install package versions from the .lock file), used in distributing the application to make sure that everybody has the same versions installed - like any other open-source project, Composer depends on Jordi's and other contributors' free time. If you think you can help, feel free to ping him and take over some of the efforts :)
Comments