Alexey
Alexey

Reputation: 363

Composer, move files from /vendor/ folder

I've just started using composer with PHPStorm 'cause I'm bored of downloading dependencies from github manually. But there are some things I can't understand.

Composer always downloads files into /vendor folder. Like if I add Twitter Bootstrap - it will be downloaded to /vendor/twitter/bootstrap folder. But I need it to be into my /webroot/bootstrap/ directory. How do you move this files? Because if I move it manually - they won't be updated later using composer update command.

Or if I use micro php framevork slim. I've added slim/slim dependency. But it will be placed into /vendor/slim/slim/...

So what should I do? Use Phing or some other deployment tool to move files from /vendor to desired destination? What do you use?

That's not exactly whar I need, but it works for css/js/etc. http://www.phpclasses.org/blog/package/8429/post/1-Using-Composer-to-Install-JavaScript-CSS-and-Images-Under-the-Web-Document-Directory.html

Upvotes: 18

Views: 18638

Answers (3)

George Wilson
George Wilson

Reputation: 5705

"config": {
    "vendor-dir": "path/to/wherever"
},

in your composer.json file

Upvotes: 31

Miroslav Trninic
Miroslav Trninic

Reputation: 3455

This question is answered here.

Vendor directory is a Composer convention. Good programming practice is to prefer convention over configuration. You can reference you files and classes in a number of ways with Composer.

Upvotes: 0

Ja͢ck
Ja͢ck

Reputation: 173642

The documentation states that you can do this:

{
    "extra": {
        "installer-paths": {
            "sites/example.com/modules/{$name}": ["vendor/package"]
        }
    }
}

Upvotes: 2

Related Questions