adipriyantobpn / yii2-composer-helper
Yii2 的 Composer 辅助工具
0.1.1
2017-09-03 21:00 UTC
Requires
- yiisoft/yii2: *
This package is not auto-updated.
Last update: 2024-09-25 02:51:51 UTC
README
Yii2 的 Composer 辅助工具
安装
安装此扩展的首选方式是通过 composer.
运行
php composer.phar require --prefer-dist adipriyantobpn/yii2-composer-helper "*"
或在您的 composer.json
文件的 require 部分添加
"adipriyantobpn/yii2-composer-helper": "*"
到
用法
扩展安装完成后,新的 composer
控制台应用程序即可在您的命令提示符中使用
$ ./yii composer -h DESCRIPTION SUB-COMMANDS - composer/batch-export Batch export for all supported data, - composer/export-all-available-packages Export all available Composer packages, which are registered in packagist.org - composer/export-installed-packages Export all installed packages - composer/export-root-packages Export all packages which specified in the composer.json - composer/require-packages Install packages via Composer, export the packages list, and commit them using git
文档
通过 -h 参数可以看到 yii2-composer-helper
的每个 CLI 子命令,如下所示。
导出根包
$ ./yii composer/export-root-packages -h
DESCRIPTION Export all packages which specified in the composer.json USAGE yii composer/export-root-packages [format] [file] [...options...] - format: string (defaults to 'json') Format of the output: text or json - file: string|null (defaults to '@common/runtime/composer-packages-root.json') File path for saving exported data, also support Yii2 path alias OPTIONS --appconfig: string custom application configuration file path. If not set, default application configuration is used. --color: boolean, 0 or 1 whether to enable ANSI color in the output. If not set, ANSI color will only be enabled for terminals that support it. --debug, -d: boolean, 0 or 1 (defaults to 1) debug the system shell command executed by this console application --help, -h: boolean, 0 or 1 whether to display help information about current command. --interactive: boolean, 0 or 1 (defaults to 1) whether to run the command interactively. --verbose, -v: boolean, 0 or 1 (defaults to 1) increase the verbosity of messages, as in composer --verbose
导出已安装包
$ ./yii composer/export-installed-packages -h
DESCRIPTION Export all installed packages USAGE yii composer/export-installed-packages [asTree] [file] [format] [...options...] - asTree: boolean, 0 or 1 (defaults to 0) List the dependencies as a tree - file: string (defaults to '@common/runtime/composer-packages.txt') File path for saving exported data, also support Yii2 path alias - format: string (defaults to 'text') Format of the output: text or json OPTIONS --appconfig: string custom application configuration file path. If not set, default application configuration is used. --color: boolean, 0 or 1 whether to enable ANSI color in the output. If not set, ANSI color will only be enabled for terminals that support it. --debug, -d: boolean, 0 or 1 (defaults to 1) debug the system shell command executed by this console application --help, -h: boolean, 0 or 1 whether to display help information about current command. --interactive: boolean, 0 or 1 (defaults to 1) whether to run the command interactively. --verbose, -v: boolean, 0 or 1 (defaults to 1) increase the verbosity of messages, as in composer --verbose
导出所有可用包
$ ./yii composer/export-all-available-packages -h
DESCRIPTION Export all available Composer packages, which are registered in packagist.org USAGE yii composer/export-all-available-packages [file] [...options...] - file: string (defaults to '@common/runtime/composer-packages-all-available.txt') File path for saving exported data, also support Yii2 path alias OPTIONS --appconfig: string custom application configuration file path. If not set, default application configuration is used. --color: boolean, 0 or 1 whether to enable ANSI color in the output. If not set, ANSI color will only be enabled for terminals that support it. --debug, -d: boolean, 0 or 1 (defaults to 1) debug the system shell command executed by this console application --help, -h: boolean, 0 or 1 whether to display help information about current command. --interactive: boolean, 0 or 1 (defaults to 1) whether to run the command interactively. --verbose, -v: boolean, 0 or 1 (defaults to 1) increase the verbosity of messages, as in composer --verbose
批量导出
$ ./yii composer/batch-export -h
DESCRIPTION Batch export for all supported data, including installed packages (as text & as tree) specified in the composer.json, and all available packages from packagist.org USAGE yii composer/batch-export [installedPackageFilePath] [installedPackageAsTreeFilePath] [allAvailablePackageFilePath] [...options...] - installedPackageFilePath: string (defaults to '@common/runtime/composer-packages.txt') $installedPackageFilePath - installedPackageAsTreeFilePath: string (defaults to '@common/runtime/composer-packages-tree.txt') $installedPackageAsTreeFilePath - allAvailablePackageFilePath: string (defaults to '@common/runtime/composer-packages-all-available.txt') $allAvailablePackageFilePath OPTIONS --appconfig: string custom application configuration file path. If not set, default application configuration is used. --color: boolean, 0 or 1 whether to enable ANSI color in the output. If not set, ANSI color will only be enabled for terminals that support it. --debug, -d: boolean, 0 or 1 (defaults to 1) debug the system shell command executed by this console application --help, -h: boolean, 0 or 1 whether to display help information about current command. --interactive: boolean, 0 or 1 (defaults to 1) whether to run the command interactively. --verbose, -v: boolean, 0 or 1 (defaults to 1) increase the verbosity of messages, as in composer --verbose
安装新包
$ ./yii composer/require-packages -h
DESCRIPTION Install packages via Composer, export the packages list, and (optionally) commit them into version control using git USAGE yii composer/require-packages <packageName> [preferSource] [commit] [...options...] - packageName (required): string Package name - preferSource: boolean, 0 or 1 (defaults to 1) Whether installing the package sources, or just install the package distribution - commit: boolean, 0 or 1 (defaults to 0) Whether commit the package list using git OPTIONS --appconfig: string custom application configuration file path. If not set, default application configuration is used. --color: boolean, 0 or 1 whether to enable ANSI color in the output. If not set, ANSI color will only be enabled for terminals that support it. --debug, -d: boolean, 0 or 1 (defaults to 1) debug the system shell command executed by this console application --help, -h: boolean, 0 or 1 whether to display help information about current command. --interactive: boolean, 0 or 1 (defaults to 1) whether to run the command interactively. --verbose, -v: boolean, 0 or 1 (defaults to 1) increase the verbosity of messages, as in composer --verbose