Andrea
Andrea

Reputation: 45

Composer with separated directories?

I'm a software developer and frequently jump from a project to another and I have a problem with Composer.

If I have 2 separated projects, each of them need a package from composer (and it's dependancies) and each of them goes on vendor, then I'll have a vendor directory full of junk. That's bad.

So how can I ask composer to install package A on vendorA and package B on vendorB? It's a simple concept but every test I did and every search I've done was useless.

Can someone have the solution? If Composer is so wide used it should be a little less dull damn!

Upvotes: 1

Views: 24

Answers (1)

Andrea
Andrea

Reputation: 45

Found already. I post the solution hoping to help other people. I use hostgator shared account, if you use something else things may differ a little.

Let's say we have /home3/user/project/app.php app.php need swiftmailer package for some reason and we don't want to put it with the rest of the packages on /home/vendor. So we are gonna put it there: /home/user/project

Standard command

composer require swiftmailer/swiftmailer

OUR command with personalized directory:

composer require swiftmailer/swiftmailer -d /home3/user/project

Hope this help someone.

Upvotes: 1

Related Questions