Codeconia -Learn Programming

How to remove a package from Laravel using the composer?

How to use frameworks should be familiar to every PHP developer. By simplifying common practices used in the development of major web projects, such as packages, modules, plug-ins, and even components, frameworks help make the development process easier.

The primary way of adding features to Laravel is to add a package or packages. They may be anything from a nice way to work with dates such as Carbon, an entire BDD testing system such as Behat, or a package that enables users to add to their application a developer toolbar that is used primarily for debugging purposes such as Debugbar.

Adding a package to Laravel
Let’s first add an example package to our Laravel website, which we will later use as an example package to remove.

We are going to use the Laravel Sitemap package. To install the package, just use the following composer command:

composer require themsaid/wink

This will automatically add the following entry in your composer.json file:

“themsaid/wink”: “^5.8”

And will download the package files in the vendor/themsaid/wink folder.

Now that we have added a package, we can use it as an example and remove it.

Removing a package from Laravel using composer
To remove a Laravel package, we just need to run a single command:

composer remove themsaid/wink


Change the themsaid/wink with the name of the package that you want to remove.

This will remove the line from your compser.json file and also the files from the vendor folder.

Don’t forget that you have to edit your code and ensure that the package is not being used.


Ajith Jojo

Add comment

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.

Most popular