PHP Composer怎么加载本地扩展包

下面由composer教程栏目给大家介绍PHP Composer怎么加载本地扩展包,希望对需要的朋友有所帮助!

目录结构:

 项目下的 HttpServerFrame/composer.json

{
  "name": "xxx/http-server-demo",
  "authors": [
    {
      "name": "xxx",
      "email": "xxx@xxx.com"
    }
  ],
  "autoload": {
    "psr-4": {
      "App\\": "app/"
    }
  },
  "repositories": {
    "0": {
      "type": "path",
      "url": "../packages/*/*",
      "options": {
        "symlink": true  //软链方式
      }
    }
  },
  "require": {
    "xxx/http-server-frame": "dev-release",
    "xxx/http-test": "dev-release"
  }
}


关注这块代码

"repositories": {
    "0": {
      "type": "path",
      "url": "../packages/*/*", //从 packages 目录下的*/* 安装此目录下必须要有composer.json
      "options": {
        "symlink": true  //软链方式
      }
    }
  },

直接composer update 即可导入,效果如下:

以上就是PHP Composer怎么加载本地扩展包的详细内容,更多请关注其它相关文章!