You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[custom-buildpack] Install extensions when required by Composer dependencies #30
The idea of the custom buildpack is to allow users to determine what PHP version and extensions are installed. However, lets revert the part about the extensions. The purpose of Composer is to:
derive dependencies based on composer.json files
install derived dependencies
So, why won't we let Composer determine what extensions are required?
The beberlei/assert package, depends on the ext-mbstring extension. I would expect that based on that dependency, the buildpack would install it. This way only the 'minimal' set of extensions would be installed, optimizing the resulting image.
Of course, for stuff like database connections that require extensions like MySQL and MongoDB, the author of the application would need to add the dependencies to its own composer.json file...
changed the title [-]Install extensions when required by Composer dependencies[/-][+][custom-buildpack] Install extensions when required by Composer dependencies[/+]on Jun 12, 2015
The part with the extensions and php versions is a bit tricky. While composer provides a way to define the php version and the extensions within the composer.json, this needs to be handled before composer is executed. composer just verifies that it was started with the correct php version and the defined extension are available.
Including the extensions of packages or sub-packages would mean, the packages needs to be inspected before composer is executed, so that composer can installed them afterwards.
Another aspect to consider is that if you have to define all extensions within your composer file you have a good knowledge about what you are using and how you need to compile your php (if you do it by your own).
Anyway we will look into this, but due to the complexity it is not the highest priority.
Understood, and agreed with the low priority / nice-to-have nature of this.
Suggestions that come to mind (not verified):
use a separate composer process (possibly using command events) to:
determine missing extensions (using Composer internals), and maybe even the requested php-image?
install missing extensions
the composer dependency resolution functionality can be wrapped in an (internal) API that is invoked to determine which extensions need to be installed. This does introduce a dependency during the container building process and is not the simplest / most elegant approach.
Activity
[-]Install extensions when required by Composer dependencies[/-][+][custom-buildpack] Install extensions when required by Composer dependencies[/+]TooAngel commentedon Jun 17, 2015
The part with the extensions and php versions is a bit tricky. While composer provides a way to define the php version and the extensions within the
composer.json, this needs to be handled before composer is executed. composer just verifies that it was started with the correct php version and the defined extension are available.Including the extensions of packages or sub-packages would mean, the packages needs to be inspected before composer is executed, so that composer can installed them afterwards.
Another aspect to consider is that if you have to define all extensions within your composer file you have a good knowledge about what you are using and how you need to compile your php (if you do it by your own).
Anyway we will look into this, but due to the complexity it is not the highest priority.
holtkamp commentedon Jun 17, 2015
Understood, and agreed with the low priority / nice-to-have nature of this.
Suggestions that come to mind (not verified):