How To Remove Package From Laravel

Websolutionstuff | Oct-31-2022 | Categories : Laravel PHP

In this article, we will see how to remove the package from laravel. there are different ways to remove packages from laravel 6, laravel 7, laravel 8, and laravel 9. You can remove packages manually as well as you can remove the packages using the composer command.

So, let's see how to remove the package using the composer command and laravel remove package.

Composer is most useful for managing the package in the laravel application. Using composer you can install, update and remove packages from the laravel application. This is more powerful, fast, and fully compatible with older versions.

Remove Package Using Composer Command

You can remove all packages no longer required in your laravel application. So, run the below command and remove the package from the vendor folder.

composer remove vendor/package name

 

Example:

composer remove laravel/ui

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

After this, we will run the following command.

php artisan config:cache

OR

php artisan cache:clear
php artisan config:clear
php artisan route:clear 
php artisan view:clear

 

Manually Remove Package

You can manually remove the package from laravel. So, run the following step and remove the package from the laravel application.

  • Remove the package class from the "providers" array in the config/app.php file.
  • Remove the package class from the "aliases" array in the config/app.php file.
  • Remove the declaration from file composer.json (in the "require" section).
  • Remove any references to the package from your code.
  • Run the below command composer update OR composer dump-autoload. This will remove the package folder from the vendor folder and will rebuild the Composer autoloading map.
  • Manually delete the published files.
  • Run Laravel Clear Cache Using Artisan Command.

 


You might also like:

Recommended Post
Featured Post
How to Install Imagick PHP Extension on Ubuntu 22.04
How to Install Imagick PHP Ext...

Hey there, fellow developers! Are you looking to enhance your PHP applications with powerful image-processing capabiliti...

Read More

Mar-06-2024

Laravel tips: DB Models and Eloquent
Laravel tips: DB Models and El...

In the realm of web development, an efficient and robust data handling mechanism is paramount. Laravel, a PHP web applic...

Read More

Oct-11-2023

How To Get Last 15 Days Records In MySQL
How To Get Last 15 Days Record...

In this tutorial, we will see how to get the last 15 days records in MySQL PHP.  In PHP, you can use INTERVAL...

Read More

Feb-09-2022

How To Create Dynamic Bar Chart In Laravel 9
How To Create Dynamic Bar Char...

In this article, we will see how to create a dynamic bar chart in laravel 9. Bar charts are used to represent...

Read More

Mar-21-2022