handsomejack
handsomejack

Reputation: 33

How to use private composer package inside another private composer package?

I have 2 composer packages I created and I want to use the first package inside the second package, and I want to use the second package in my main app.

Now when I run composer update my main app can see the 2nd package, but 2nd package can't see the first package.

The error im getting is:

Your requirements could not be resolved to an installable set of packages.

Problem 1

  • Installation request for mycompany/package1 dev-branch1 -> satisfiable by mycompany/package1[dev-branch1].
  • mycompany/package1 dev-branch1 requires mycompany/package2 dev-master -> no matching package found.

Potential causes:

Read https://getcomposer.org/doc/articles/troubleshooting.md for further common problems.

But when I run composer install in the 2nd package there is no problem and it installs the 1st package to 2nd package.

So is there a way to install a package, which is dependent to another custom package?

Upvotes: 0

Views: 640

Answers (1)

lockonzero
lockonzero

Reputation: 126

If you add the 2nd package directly on the main project does it install? Composer cannot chain load dependencies on its own as described here.

https://getcomposer.org/doc/faqs/why-can%27t-composer-load-repositories-recursively.md

Like the documentation says, in case of private packages, you must use Satis or a private Packagist instance for this use case

Upvotes: 1

Related Questions