W3cubDocs

/Ansible

composer - Dependency Manager for PHP

New in version 1.6.

Synopsis

Composer is a tool for dependency management in PHP. It allows you to declare the dependent libraries your project needs and it will install them in your project for you

Requirements (on host that executes module)

  • php
  • composer installed in bin path (recommended /usr/local/bin)

Options

parameter required default choices comments
arguments
(added in 2.0)
no
Composer arguments like required package, version and so on
command
(added in 1.8)
no install
Composer command like "install", "update" and so on
ignore_platform_reqs
(added in 2.0)
no no
  • yes
  • no
Ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these.
aliases: ignore-platform-reqs
no_dev
no yes
  • yes
  • no
Disables installation of require-dev packages ( see --no-dev )
aliases: no-dev
no_plugins
no no
  • yes
  • no
Disables all plugins ( see --no-plugins )
aliases: no-plugins
no_scripts
no no
  • yes
  • no
Skips the execution of all scripts defined in composer.json ( see --no-scripts )
aliases: no-scripts
optimize_autoloader
no yes
  • yes
  • no
Optimize autoloader during autoloader dump ( see --optimize-autoloader ). Convert PSR-0/4 autoloading to classmap to get a faster autoloader. This is recommended especially for production, but can take a bit of time to run so it is currently not done by default.
aliases: optimize-autoloader
prefer_dist
no no
  • yes
  • no
Forces installation from package dist even for dev versions ( see --prefer-dist )
aliases: prefer-dist
prefer_source
no no
  • yes
  • no
Forces installation from package sources when possible ( see --prefer-source )
aliases: prefer-source
working_dir
yes
Directory of your project ( see --working-dir )
aliases: working-dir

Examples

# Downloads and installs all the libs and dependencies outlined in the /path/to/project/composer.lock
- composer: command=install working_dir=/path/to/project

- composer:
    command: "require"
    arguments: "my/package"
    working_dir: "/path/to/project"

# Clone project and install with all dependencies
- composer:
    command: "create-project"
    arguments: "package/package /path/to/project ~1.0"
    working_dir: "/path/to/project"
    prefer_dist: "yes"

Notes

Note

Default options that are always appended in each execution are –no-ansi, –no-interaction and –no-progress if available.

Note

We received reports about issues on macOS if composer was installed by Homebrew. Please use the official install method to avoid it.

This is an Extras Module

For more information on what this means please read Extras Modules

For help in developing on modules, should you be so inclined, please read Community Information & Contributing, developing_test_pr and Developing Modules.

© 2012–2016 Michael DeHaan
© 2016 Red Hat, Inc.
Licensed under the GNU General Public License version 3.
https://docs.ansible.com/ansible/composer_module.html