Banana
Banana

Reputation: 4218

Install composer dependency in root of project

I have two PHP projects, one of which depends on the other. I want to import the projectA into projectB using composer, but non in vendor folder, or any other custom named folder. I want to import the project into the root of projectB. Can this be achieved?

I tried using this:

"config" : {
  "vendor-dir" : "/"
}

But, I get [RuntimeException] does not exist and could not be created. Tried with backslash and empty string, but none work.

Upvotes: 0

Views: 4341

Answers (1)

Danack
Danack

Reputation: 25701

"vendor-dir" : "/"

That is pointing to the root directory, not the current directory which would be "./"

I want to import the project into the root of projectB. Can this be achieved?

No, the composer file of the other project would over-write the composer.json of the project that is importing it.

However you should probably just ask how to solve the problem you're trying to fix rather than asking about specific solutions to that problem, as you appear to be having an XY Problem.

If you want files to be available in a particular directory of ProjectB after installing ProjectA (e.g. to make Javascript files be available to web browsers) you should look at using scripts in Composer to copy the files across to the correct directory.

Upvotes: 3

Related Questions