gurghet
gurghet

Reputation: 7707

Is it possible to install a composer package without updating the composer.json

I want to install a composer package, but I only want it in my environment for developing purposes, I don't want other developers to install it or even see that I have it.

What is the equivalent of npm install pack/age without the --save in composer?

Upvotes: 2

Views: 1394

Answers (1)

Chris
Chris

Reputation: 136968

I don't think there is an exact Composer equivalent to npm install without --save.

One way to get a similar result is to use Composer's global command to install the package globally for your user:

composer global require some/package

This is much like npm install -g if you've configured NPM to put such modules in your home directory instead of in a shared location. Binaries will then be available in your global vendor binaries directory, which on my machine is ~/.config/composer/vendor/bin/.

Another option would be to simply use composer require in your project directory and then revert any changes to composer.json and composer.lock with whatever version control system you use. The downside of this is that the newly installed packages won't be included in your autoloader the next time it gets generated.

Upvotes: 5

Related Questions