How can I find unused libraries in a project ? (PhpStorm)

I try to find and also to delete all the unused libraries in a project. For example I have a folder lib/ with lot of other folder which are the famous libraries. I want to know how I can identify which libraries are not used.

Can you help me ?

Thank you !

1
2 comments

There's no easy way of doing this (e.g. right click a directory > run inspection against it) unfortunately.

A common way would be:

- open a library file(s) (yes, all of them, one by one), right click a class > Find Usages. You can ease this using a "Structure" tool window:

There's also a general PHP "unused" inspection group: PHP | Unused. You can run it against your code - this would show unused imports.

1
Avatar
Permanently deleted user

Ok thank you for your answer ! I will investigate more because there are too many libraries in the project and I can't afford to click on all the files one by one ... (hudge project).

0

Please sign in to leave a comment.