-1

Due to an existing company policy, I have to install packages in a directory other than the default ./vendor but composer stubbornly continues to create the default ./vendor directory and install everything there.

As per the FAQ, I have the following composer.json contents:


  "require": {
    "monolog/monolog": "*"
  },
  "extra": {
    "installer-paths": {
      "3rdparty/": ["type:library"]
    }
  }
}
~   

I expected this to install monolog under ./3rdparty but it doesn't. What am I missing?

A.L
  • 10,259
  • 10
  • 67
  • 98
  • *I am attempting to install packages in a directory other than the default `./vendor`* Why? It looks like it create more problems than it would solve. – A.L Jul 10 '23 at 16:09
  • @A.L I'm required to adhere to an existing company policy. That said, answers to the tune of "don't do that then" aren't really helpful. If I didn't have to muck around with this, I wouldn't. – Frank van Wensveen Jul 10 '23 at 17:24
  • Thanks for clarifying it, it wasn't mentioned in the question. I wanted to ensure that it wasn't an [XY problem](https://meta.stackexchange.com/a/66378/237701). – A.L Jul 10 '23 at 17:33
  • it's config vendor-dir or COMPOSER_VENDOR_DIR and has nothing to do with installers, this is standard composer configuration. https://getcomposer.org/doc/06-config.md#vendor-dir / https://getcomposer.org/doc/03-cli.md#composer-vendor-dir – hakre Jul 10 '23 at 18:22
  • @hakre please add this as answer. – A.L Jul 10 '23 at 19:17
  • 2
    @A.L: The answer exists already, no need to add it, see https://stackoverflow.com/a/11883676/367456 and related. – hakre Jul 10 '23 at 19:58

1 Answers1

2

I think the list of packages that can use this option is limited, there is a note at the bottom of this FAQ page :

Note: You cannot use this to change the path of any package. This is only applicable to packages that require composer/installers and use a custom type that it handles.

Maybe this repository will do the trick ?