How to remove a package from Laravel using Composer

Composer is dependency manager for PHP packages. Laravel also uses composer to install and remove packages from the application.

In this article, we will see how to remove package from your Laravel application. Actually you can remove package from any PHP application which uses composer as package manager. Run the following command and it will remove the package from the application. It will also update composer.json and composer.lock automatically.

composer remove vendor/package

After that, you will also need to remove references to that package within your application, from config, controllers etc. otherwise it may give class not found error because you have removed all class files from application.