douqiao8370 2017-09-05 15:37
浏览 57
已采纳

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

I am developing a PHP package and I have added a testing version to packagist so now I can install my package simply like this composer require timino/timino dev-master the package is installed correctly However the package is installed inside the vendor folder like so

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

So it is completely different to my desired structure and in this case i need to point the server root to a very long path furthermore i need to generate another composer autoload inside . so if it is possible i want to let composer install the package outside vendor to look exactly the same as my local version of the project like so

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

I have seen so far the get composer website documentation on how to install a package in a custom location but i cant seem to find a practical example to my issue.

How can i let composer do so ? thanks.

  • 写回答

1条回答 默认 最新

  • dtrgqjcd877528 2017-09-08 21:45
    关注

    Run

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

    to create a new project based on timino/timino:dev-master in the directory foo-bar-baz.

    For reference, see:

    Example

    I ran

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

    which results in

    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
    

    and then

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

    which results in

    foo-bar-baz
    ├── App
    ├── pub
    ├── vendor
    ├── README.md
    ├── composer.json
    └── composer.lock
    
    3 directories, 3 files
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#hadoop#的问题
  • ¥15 (标签-Python|关键词-socket)
  • ¥15 keil里为什么main.c定义的函数在it.c调用不了
  • ¥50 切换TabTip键盘的输入法
  • ¥15 可否在不同线程中调用封装数据库操作的类
  • ¥15 微带串馈天线阵列每个阵元宽度计算
  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据