lotfio
lotfio

Reputation: 1936

Composer install package in front of vendor folder not inside as a third party

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.

Upvotes: 0

Views: 1366

Answers (1)

localheinz
localheinz

Reputation: 9592

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

Upvotes: 1

Related Questions