How to add or remove package in Laravel application

  546 views   9 months ago Laravel

When you upgrade your Laravel application or doing changes in appliction, then you might want to add new package or remove pacakge from Laravel application. Laravel uses composer package manager to add or remove packages.

Add package in Laravel

You can add new package in Laravel using composer installation command. Suppose you want to install Laravel Passport in your Laravel application.

composer require laravel/passport

This will add all package files into vendor folder. Your application composer.json file is also updated. Composer manages all package through composer.json file.

Remove package from Laravel

In the same way you can remove package from Laravel using composer remove command.

composer remove laravel/passport

This will remove package files from vendor folder and also from composer.json. You can find the pacakges list in composer.json file.

The last step is to remove package class reference from your application e.g., from config/app.php or controller file else it will give class not found error.

Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]