In App Platform for PHP Environment. How do i force the composer install to install the packages including dev?

Currently it looks like the installing dependencies process only installed the packages for prod and no dev. I tried to use build_command: composer install --dev in app spec.yml but no luck/still error.

As with Symfony Framework, there are “post-install-cmd” scripts where it’s executed after package installed and since the env are dev. It expected if the application have installed the package in “require-dev” part.

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
2 answers


Usually, the recommendation is that if a dependency is needed to build the app for production, then it should be a regular dependency and not a dev dependency.

However, if you really want to, you can configure the build to install dev dependencies. I must say that this is not officially supported so there are no guarantees that this method will work forever. To install dev dependencies, add an environment variable called HEROKU_PHP_INSTALL_DEV with no value. Leave the value text field empty. This is very important otherwise it might break the build.

Again, I would recommend doing this only for testing. If it fixes the issue then I would recommend updating your composer.json and moving the necessary dependencies from require-dev to require (and removing the workaround).

  • Thank you @kamaln7 , this is what i looking for. Will try it and let you know if it works.

    I do agree ideally the app deployed should be prod env. But sometime in early development we still need test/dev environment for rapid development.

    I usually have 1 specific server with dev/test ENV for my dev & QA team to testing to view all the error before we escalate to staging ENV>

Hi, Personally I found more convenient to drop a Dockerfile into the root folder of the git repository and DO will build it for you. This is worked for me better.