salt.states.composer#
Installation of Composer Packages#
These states manage the installed packages for composer for PHP. Note that either composer is installed and accessible via a bin directory or you can pass the location of composer in the state.
get-composer:
cmd.run:
- name: 'CURL=`which curl`; $CURL -sS https://getcomposer.org/installer | php'
- unless: test -f /usr/local/bin/composer
- cwd: /root/
install-composer:
cmd.wait:
- name: mv /root/composer.phar /usr/local/bin/composer
- cwd: /root/
- watch:
- cmd: get-composer
/path/to/project:
composer.installed:
- no_dev: true
- require:
- cmd: install-composer
# Without composer installed in your PATH
# Note: composer.phar must be executable for state to work properly
/path/to/project:
composer.installed:
- composer: /path/to/composer.phar
- php: /usr/local/bin/php
- no_dev: true
- salt.states.composer.installed(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='/root', always_check=True, env=None)#
Verify that the correct versions of composer dependencies are present.
- name
Directory location of the
composer.jsonfile.- composer
Location of the
composer.pharfile. If not set composer will just executecomposeras if it is installed globally. (i.e./path/to/composer.phar)- php
Location of the php executable to use with composer. (i.e.
/usr/bin/php)- user
Which system user to run composer as.
New in version 2014.1.4.
- prefer_source
--prefer-sourceoption of composer.- prefer_dist
--prefer-distoption of composer.- no_scripts
--no-scriptsoption of composer.- no_plugins
--no-pluginsoption of composer.- optimize
--optimize-autoloaderoption of composer. Recommended for production.- no_dev
--no-devoption for composer. Recommended for production.- quiet
--quietoption for composer. Whether or not to return output from composer.- composer_home
$COMPOSER_HOMEenvironment variable- always_check
If
True, always runcomposer installin the directory. This is the default behavior. IfFalse, only runcomposer installif there is no vendor directory present.- env
A list of environment variables to be set prior to execution.
- salt.states.composer.update(name, composer=None, php=None, user=None, prefer_source=None, prefer_dist=None, no_scripts=None, no_plugins=None, optimize=None, no_dev=None, quiet=False, composer_home='/root', env=None)#
Composer update the directory to ensure we have the latest versions of all project dependencies.
- name
Directory location of the
composer.jsonfile.- composer
Location of the
composer.pharfile. If not set composer will just executecomposeras if it is installed globally. (i.e. /path/to/composer.phar)- php
Location of the php executable to use with composer. (i.e.
/usr/bin/php)- user
Which system user to run composer as.
New in version 2014.1.4.
- prefer_source
--prefer-sourceoption of composer.- prefer_dist
--prefer-distoption of composer.- no_scripts
--no-scriptsoption of composer.- no_plugins
--no-pluginsoption of composer.- optimize
--optimize-autoloaderoption of composer. Recommended for production.- no_dev
--no-devoption for composer. Recommended for production.- quiet
--quietoption for composer. Whether or not to return output from composer.- composer_home
$COMPOSER_HOMEenvironment variable- env
A list of environment variables to be set prior to execution.