community.general.composer (8.5.0) — module

Dependency Manager for PHP

Authors: Dimitrios Tydeas Mengidis (@dmtrs), René Moser (@resmo)

Install collection

Install with ansible-galaxy collection install community.general:==8.5.0


Add to requirements.yml

  collections:
    - name: community.general
      version: 8.5.0

Description

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

Usage examples

  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Download and installs all libs and dependencies outlined in the /path/to/project/composer.lock
  community.general.composer:
    command: install
    working_dir: /path/to/project
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install a new package
  community.general.composer:
    command: require
    arguments: my/package
    working_dir: /path/to/project
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Clone and install a project with all dependencies
  community.general.composer:
    command: create-project
    arguments: package/package /path/to/project ~1.0
    working_dir: /path/to/project
    prefer_dist: true
  • Success
    Steampunk Spotter scan finished with no errors, warnings or hints.
- name: Install a package globally
  community.general.composer:
    command: require
    global_command: true
    arguments: my/package

Inputs

    
no_dev:
    default: true
    description:
    - Disables installation of require-dev packages (see --no-dev).
    type: bool

command:
    default: install
    description:
    - Composer command like "install", "update" and so on.
    type: str

arguments:
    default: ''
    description:
    - Composer arguments like required package, version and so on.
    type: str

executable:
    aliases:
    - php_path
    description:
    - Path to PHP Executable on the remote host, if PHP is not in PATH.
    type: path

no_plugins:
    default: false
    description:
    - Disables all plugins (see --no-plugins).
    type: bool

no_scripts:
    default: false
    description:
    - Skips the execution of all scripts defined in composer.json (see --no-scripts).
    type: bool

prefer_dist:
    default: false
    description:
    - Forces installation from package dist even for dev versions (see --prefer-dist).
    type: bool

working_dir:
    description:
    - Directory of your project (see --working-dir). This is required when the command
      is not run globally.
    - Will be ignored if O(global_command=true).
    type: path

prefer_source:
    default: false
    description:
    - Forces installation from package sources when possible (see --prefer-source).
    type: bool

global_command:
    default: false
    description:
    - Runs the specified command globally.
    type: bool

apcu_autoloader:
    default: false
    description:
    - Uses APCu to cache found/not-found classes
    type: bool

composer_executable:
    description:
    - Path to composer executable on the remote host, if composer is not in E(PATH) or
      a custom composer is needed.
    type: path
    version_added: 3.2.0
    version_added_collection: community.general

optimize_autoloader:
    default: true
    description:
    - Optimize autoloader during autoloader dump (see --optimize-autoloader).
    - Convert PSR-0/4 autoloading to classmap to get a faster autoloader.
    - Recommended especially for production, but can take a bit of time to run.
    type: bool

ignore_platform_reqs:
    default: false
    description:
    - Ignore php, hhvm, lib-* and ext-* requirements and force the installation even if
      the local machine does not fulfill these.
    type: bool

classmap_authoritative:
    default: false
    description:
    - Autoload classes from classmap only.
    - Implicitly enable optimize_autoloader.
    - Recommended especially for production, but can take a bit of time to run.
    type: bool