Это старая версия документа!
Composer (php)
Установка
$ curl -sS https://getcomposer.org/installer | php $ mv composer.phar /usr/local/bin/composer
Установка с параметрами
- curl -sS https://getcomposer.org/installer | php – —version=1.0.0-alpha10
Устанока пакетов из composer.json
composer --prefer-dist install
Ключи
Справка
- composer install -h
- composer update -h
- composer update psr/container psr/log
- composer update timoschinkel/codeowners-cli -w
- composer update timoschinkel/codeowners-cli:1.1.0
- composer require -h
- composer update -vvv
- composer why webdev/docker-deployer-recipes
- composer why-not webdev/docker-deployer-recipes
- composer why-not php:8.0.0
- composer outdated –format json –strict
install
--prefer-source Forces installation from package sources when possible, including VCS information. --prefer-dist Forces installation from package dist even for dev versions. --dry-run Outputs the operations but will not execute anything (implicitly enables --verbose). --dev Enables installation of require-dev packages (enabled by default, only present for BC). --no-dev Disables installation of require-dev packages. --no-custom-installers DEPRECATED: Use no-plugins instead. --no-autoloader Skips autoloader generation --no-scripts Skips the execution of all scripts defined in composer.json file. --no-progress Do not output download progress. --no-suggest Do not show package suggestions. -o, --optimize-autoloader Optimize autoloader during autoloader dump -a, --classmap-authoritative Autoload classes from the classmap only. Implicitly enables `--optimize-autoloader`. --ignore-platform-reqs Ignore platform requirements (php & ext- packages). -h, --help Display this help message -q, --quiet Do not output any message -V, --version Display this application version --ansi Force ANSI output --no-ansi Disable ANSI output -n, --no-interaction Do not ask any interactive question --profile Display timing and memory usage information --no-plugins Whether to disable plugins. -d, --working-dir=WORKING-DIR If specified, use the given directory as working directory. -v|vv|vvv, --verbose Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
update
Установка пакета
php composer.phar require --prefer-dist yiisoft/yii2-gii "*"
php composer.phar require --prefer-dist kop/yii2-scroll-pager "dev-master"
php composer.phar require -vvv --prefer-dist webcreate/jquery-ias "dev-master"
- –prefer-dist - Удаляет папку .git из модулей
Удаление пакета
php composer.phar remove skeeks/cms-shop
Флаги
- --prefer-dist - Не заливать репозиторий а взять из архива
Установка пакета через конфиг
"kop/yii2-scroll-pager": "dev-master"
Установленные пакеты
php composer.phar show -i
Обновление пакетов
php composer.phar update
Отключение кеша или его очистка
Отключение
COMPOSER_CACHE_DIR=/dev/null composer install
Очистка
rm -rf "`composer config cache-dir`"
Возникающие ошибки
The "https://asset-packagist.org/packages.json" file could not be downloaded: SSL operation failed with code 1.
https://asset-packagist.org could not be fully loaded, package information was loaded from the local cache and may be out of date $ php -i | grep -i ssl Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, sslv2, tls, tlsv1.0, tlsv1.1, tlsv1.2 SSL => Yes SSL Version => OpenSSL/1.0.2l OpenSSL support => enabled core SSL => supported extended SSL => supported openssl OpenSSL support => enabled OpenSSL Library Version => OpenSSL 1.1.0f 25 May 2017 OpenSSL Header Version => OpenSSL 1.1.0e 16 Feb 2017 Openssl default config => /usr/lib/ssl/openssl.cnf openssl.cafile => no value => no value openssl.capath => no value => no value Native OpenSSL support => enabled
Расширения
- composer global require "fxp/composer-asset-plugin:dev-master" https://github.com/francoispluchino/composer-asset-plugin