Leveraging Composer

Learn how to integrate Composer into your development workflow with fortrabbit.

No need to explain this anymore: Composer is the defacto standard to handle PHP application dependencies, as well as providing mechanisms to keep them up2date.


TL;DR: Just git push. On fortrabbit you (of course) exclude the vendor folder from Git. This directory is created by Composer within in your project locally and contains all the packages you are using. This way only your own code — not any dependency — is included into Git.

During deployment to fortrabbit Composer will be executed automatically, assuming that both the composer.lock file and the composer.json file are present.

The deployment build process executes composer install and never the update variant to make sure that exactly the packages your App requires are installed.

Composer in the deployment file

You can fine tune your deployment behavior and aspects of Composer in the deployment file. See the options withunder the composer: keyword here.

Use Private repositories in Composer

You need to add the private repositories into your composer.json file? Read on here.

Composer from SSH

Universal Apps only: You can execute Composer from SSH. Composer is pre-installed (latest stable) per default and all you need to do is execute it:

$ ssh {{ssh-user}}@deploy.{{region}}.frbit.com
$ composer install

Use alternative location

If your composer.json and composer.lock file are not on top level, then they will be ignored by the deployment. However, you can use the pre directive from the deployment file to setup a custom composer run in a different directory.

Following an example which assumes that your composer.* files are within the folder sub-folder:


version: 2

# execute alternate composer run before anything
pre: composer-run.php

# makre sure the new vendor folder is sustained during deploys
  - sub-folder/vendor



exec("composer install");

Further readings

Need individual help?

Get support › Learn about Company plans ›

Looking for an old article?

See the full list of articles ›

Found an error?

Contribute on GitHub ›