Home >Development Tools >composer >How to load local extension package in PHP Composer

How to load local extension package in PHP Composer

藏色散人
藏色散人forward
2021-05-26 16:26:553587browse

下面由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 即可导入,效果如下:

The above is the detailed content of How to load local extension package in PHP Composer. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete