1. 下载:
    wget -O composer http://file.job520.net/linux/php/composer.phar
    mv composer /usr/local/bin/
    chmod +x /usr/local/bin/composer
  2. 常用命令:
    1. 配置镜像:
      composer config -g repo.packagist composer https://packagist.phpcomposer.com
    2. 删除镜像:
      composer config -g --unset repos.packagist
    3. 查找包:
      composer search 包名
    4. 安装包:
      1. 安装最新版:
        composer require test_name/test_pack
      2. 指定版本:
        composer require test_name/test_pack x.x.*
    5. 使用包:
      require_once "vendor/autoload.php";
    6. 更新:
      composer update
    7. 删除:
      composer remove test_name/test_pack
    8. 搭建项目:
      composer create-project test_name/test_pack
  3. 发布包:
    1. 初始化:
      composer init
    2. 配置参考:
      {
      "name": "job520/uploader",
      "description": "自用文件上传包",
      "authors": [
       {
           "name": "lee",
           "email": "complet@163.com"
       }
      ],
      "autoload":{
       "psr-4":{"job520\\":"src/"}
      }
      }
    3. 目录结构:
    4. 上传包:
      https://packagist.org/packages/codeception/
文档更新时间: 2020-10-23 09:26   作者:lee