Working with composer

Composer is activated when you supply a composer.json or composer.lock file. A composer.lock is not required, but is strongly recommended for consistent deployments.

The NodeChef PHP hosting buildpack supports a subset of the version formats supported by Composer. The buildpack supported formats are:

Example Expected Version
5.3.* latest 5.4.x release (5.3 is not supported)
>=5.3 latest 5.4.x release (5.3 is not supported)
5.4.* latest 5.4.x release
>=5.4 latest 5.4.x release
5.5.* latest 5.5.x release
>=5.5 latest 5.5.x release
5.4.x specific 5.4.x release that is listed
5.5.x specific 5.5.x release that is listed

Configuring composer

The buildpack runs with a set of default values for Composer. You can adjust these values by adding a .bp-config/options.json file to your application and setting any of the following values in it.

The below example shows an example PHP app directory after you create the .bp-config/options.json file.

index.php composer.json .bp-config/ options.json

An example options.json file to configure composer:

{ "COMPOSER_VERSION": "", "COMPOSER_INSTALL_OPTIONS": "" }

COMPOSER_INSTALL_OPTIONS
A list of options that should be passed to composer install. This defaults to --no-interaction --no-dev --no-progress. The --no-progress option must be used due to the way the buildpack calls Composer.

Github

Composer uses Github’s API to retrieve zip files for installation into the application folder. If you do not vendor dependencies before pushing an app, Composer will fetch dependencies during staging using the Github API.

Github’s API is request-limited. If you reach your daily allowance of API requests (typically 60), Github’s API returns a 403 error and staging fails.