Installing Composer Dependencies

Nitro is no longer supported. Please see our announcement and DDEV migration guide.

Nitro’s composer command lets you to run any composer command without having Composer installed on your host machine.

$ cd ~/dev/my-craft-project
$ nitro composer install
  … checking /Users/oli/dev/my-craft-project/composer.json ✓
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Nothing to install, update or remove
Generating optimized autoload files
79 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
composer install completed 🤘

# Using Composer 1

Each Nitro site comes with Composer 2 installed by default. If you need to use Composer 1, you can SSH into the site and update it manually:

  1. Navigate to your project:
    $ cd ~/dev/my-craft-project
  2. SSH into your site’s container with all-powerful root user permissions:
    $ nitro ssh --root
  3. Update Composer to version 1:
    $ composer self-update --1
  4. Optionally exit your site’s container and return to your host machine:
    $ exit

Because site containers are ephemeral, you’ll need to do this again any time you rebuild its Docker container!