How to add or remove package from laravel using composer

How to add or remove package from laravel using composer

To add a package, use the composer require command followed by the vendor/package name. For example:

Lets take example for the package “spatie/laravel-permission”

To add the packages use below command in your terminal.

composer require spatie/laravel-permission

To remove the packages use below command in your terminal.

composer remove spatie/laravel-permission

In other way to remove package:

  • Manually delete the line in require from composer.json
  • Run composer update