Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get multiple vendor directories with composer?

My project relies on ZF and on a JS library. I wanted to be able to deploy the ZF library to the normal location (vendor/zendframework/zendframework1) but then deploy my JS library to somewhere else (public/my-vendor/my-library). Is there anyway to do this?

like image 522
ddelrio1986 Avatar asked Oct 19 '25 02:10

ddelrio1986


2 Answers

Composer is meant to manage your PHP dependencies, not JS.

Also, it only supports one vendor folder.

You might follow the way Symfony bundles use:

  • install everything in vendor
  • link (or copy) public assets to a public directory as part of your deployment process

In my opinion it's safer than installing something in a public folder (as long as you copy/link public part of a library only).

like image 161
Jakub Zalas Avatar answered Oct 21 '25 16:10

Jakub Zalas


I came across the symlink idea but I wanted to automate this instead of manually creating the symlinks. I was going to create a composer script to create the symlink. I then found that symlinks on Windows and *nix need to be created in different ways which made this solution get messier by the second. I found that in the composer docs they talk about this same type of issue on the custom installers page and say that to solve this to create your own custom installer.

  • Relavent docs section: http://getcomposer.org/doc/articles/custom-installers.md
  • My custom installer: https://github.com/ddelrio1986/zf1-public-asset-installer
like image 35
ddelrio1986 Avatar answered Oct 21 '25 15:10

ddelrio1986



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!