Question

App Platform Composer Install With Dev

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.

Subscribe
Share

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Hi,

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).

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.