Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Want to add a new plugin using composer instead of updating all plugins

I want to add a particular plugin in my laravel app using composer. I don't want to sync whole of the plugins with composer.json, I just want to add a new plugin.

If I remove rest of the plugins and add a json value i.e. "mgallegos/laravel-jqgrid": "1.*", once the files are downloaded, all of the plugins get removed because they are not mentioned there in json file.

Can I only add 1 particular plugin without making any changes in rest of the plugins?

Here is what my json file looks like:

enter image description here

like image 628
Danyal Sandeelo Avatar asked Mar 11 '23 21:03

Danyal Sandeelo


1 Answers

To install particular package, use require command like this:

composer require vendor/package_name ~version

To update only single package, use update command:

composer update vendor/package_name

To update multiple packages at once:

composer update vendor/package_name vendor/package_name2

Options with update command:

  • --prefer-source: Install packages from source when available.
  • --prefer-dist: Install packages from dist when available.
  • --ignore-platform-reqs: ignore php, hhvm, lib-* and ext-* requirements and force the installation even if the local machine does not fulfill these. See also the platform config option.
  • --dry-run: Simulate the command without actually doing anything.
  • --dev: Install packages listed in require-dev (this is the default behavior).
  • --no-dev: Skip installing packages listed in require-dev. The autoloader generation skips the autoload-dev rules.
  • --no-autoloader: Skips autoloader generation.
  • --no-scripts: Skips execution of scripts defined in composer.json.
  • --no-progress: Removes the progress display that can mess with some terminals or scripts which don't handle backspace characters.
  • --optimize-autoloader (-o): Convert PSR-0/4 autoloading to classmap to get a faster autoloader. This is recommended especially for production, but can take a bit of time to run so it is currently not done by default.
  • --classmap-authoritative (-a): Autoload classes from the classmap only. Implicitly enables --optimize-autoloader.
  • --lock: Only updates the lock file hash to suppress warning about the lock file being out of date.
  • --with-dependencies: Add also all dependencies of whitelisted packages to the whitelist.
  • --root-reqs: Restricts the update to your first degree dependencies.
  • --prefer-stable: Prefer stable versions of dependencies.
  • --prefer-lowest: Prefer lowest versions of dependencies. Useful for testing minimal versions of requirements, generally used with --prefer-stable.

Reference: https://getcomposer.org/doc/03-cli.md

like image 197
Alok Patel Avatar answered Mar 30 '23 01:03

Alok Patel