Composer安装包在供应商文件夹前面而不是作为第三方

时间:2017-09-05 15:37:13

标签: php composer-php

我正在开发一个PHP包,我已经将一个测试版本添加到packagist所以现在我可以像我这样安装我的包composer require timino/timino dev-master正确安装包但是包安装在供应商文件夹里面就像这样< / p>

timino
└── vendor
    ├── composer
    └── timino
        └── timino
            ├── App
            │ 
            └── pub

所以它与我想要的结构完全不同,在这种情况下我需要将server root指向一条很长的路径,而且我需要在里面生成另一个作曲家自动加载。所以,如果有可能的话,我想让作曲家在供应商外面安装包,看起来和我的本地版本的项目完全相同

   timino
    ├── App // business logic
    │   
    ├── pub  // public root dir for servers (apache or nginx)
    │
    └── vendor // 3rd party 

到目前为止,我已经看到了get composer website documentation on how to install a package in a custom location,但我似乎无法找到一个解决我问题的实际例子。

我怎样才能让作曲家这样做?感谢。

1 个答案:

答案 0 :(得分:1)

运行

$ composer create-project timino/timino foo-bar-baz "dev-master"

在目录timino/timino:dev-master中基于foo-bar-baz创建新项目。

供参考,见:

实施例

我跑了

$ composer create-project timino/timino foo-bar-baz "dev-master"

导致

Installing timino/timino (dev-master 3db1cda092af6bdf9bdb754c353f97d7e3121141)
  - Installing timino/timino (dev-master master): Cloning master from cache
Created project in foo-bar-baz
Loading composer repositories with package information
Updating dependencies (including require-dev)
Nothing to install or update
Writing lock file
Generating autoload files
Do you want to remove the existing VCS (.git, .svn..) history? [Y,n]? Y

然后

$ tree -L 1 --dirsfirst foo-bar-baz

导致

foo-bar-baz
├── App
├── pub
├── vendor
├── README.md
├── composer.json
└── composer.lock

3 directories, 3 files