This command will guide you through creating your composer.json config.
Package name (<vendor>/<name>) [waq/composer_test]: Description []: Author [晴x <24xxxxxx50@qq.com>, n to skip]: Minimum Stability []: dev Package Type (e.g. library, project, metapackage, composer-plugin) []: License []:
Define your dependencies.
Would you like to define your dependencies (require) interactively [yes]? yes Search for a package: Would you like to define your dev dependencies (require-dev) interactively [yes]? yes Search for a package: Add PSR-4 autoload mapping? Maps namespace "Waq\ComposerTest" to the entered relative path. [src/, n to skip]:
Do you confirm generation [yes]? y Generating autoload files Generated autoload files PSR-4 autoloading configured. Use "namespace Waq\ComposerTest;" in src/ Include the Composer autoloader with: require 'vendor/autoload.php';
Warning from https://mirrors.aliyun.com/composer: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2.
解决方法: 更新一下 composer 工具版本:
1
composer self-update
出现错误:
1 2 3 4
The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1.
Warning from https://mirrors.aliyun.com/composer: You are using an outdated version of Composer. Composer 2.0 is now available and you should upgrade. See https://getcomposer.org/2
原因:从报错信息可以看出是composer版本太旧的。
解决办法:升级本地的composer版本, composer self-update
执行composer self-update
macOS: Installing composer fails with error "The "https://getcomposer.org/versions" file could not be downloaded: SSL operation failed with code 1"