0

I would like to know if there is any way to know which of all packages I have installed in my Laravel project I'm not using, for example, I have:

require": {
        "php": "^7.3|^8.0",
        "andreiio/blade-iconoir": "^2.10",
        "andreiio/blade-remix-icon": "^2.4",
        "barryvdh/laravel-dompdf": "^2.0",
        "blade-ui-kit/blade-ui-kit": "^0.3.4",
        **"brunocfalcao/blade-feather-icons": "^3.0",**
        **"codeat3/blade-akar-icons": "^1.22",**
        "codeat3/blade-carbon-icons": "^2.12",
       ** "codeat3/blade-file-icons": "^1.8",**
       ** "codeat3/blade-iconpark": "^1.5",**
        "codeat3/blade-mono-icons": "^1.3",
        "fruitcake/laravel-cors": "^2.0",
        "guzzlehttp/guzzle": "^7.0.1",
        "laravel/breeze": "1.9.4",
        "laravel/framework": "^8.75",
        "laravel/sanctum": "^2.11",
        "laravel/tinker": "^2.5",
        "maatwebsite/excel": "^3.1",
        "nerdroid23/blade-icomoon": "^1.1",
        "owenvoke/blade-fontawesome": "^1.10",
        "phpoffice/phpspreadsheet": "^1.29",
        "ryangjchandler/blade-tabler-icons": "^1.2",
        "troccoli/blade-health-icons": "^1.0"
    }

Let say the ones between ** ** are the ones I'm not using, but I don't know they are the ones I'm not using, so I'm asking if there is a way to get those and uninstall them.

I tried phpstan without results

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
  • Does [this](https://stackoverflow.com/questions/23126562/how-can-i-remove-a-package-from-laravel-using-php-composer) answer the question? – Tpojka Aug 15 '23 at 16:15
  • 2
    There is a small project, which is trying to solve this problem, but I'm not sure, how good the results really are: https://github.com/composer-unused/composer-unused – rickroyce Aug 15 '23 at 16:34
  • @Tpojka No it doesn't – Borja Lorenzo Aug 15 '23 at 21:01

1 Answers1

0

there is no built-in methods in composer to list/remove the unused packages but there are some tools that can help you list the unused packages like composer-unused

first you need to download the composer-unused.phar using this command on your project :

curl -OL https://github.com/composer-unused/composer-unused/releases/latest/download/composer-unused.phar

you can download it manually and put it in your project too.

after that execute this command :

php composer-unused.phar

you will get list of unused packages.

HichemTech
  • 389
  • 2
  • 6