tomasvotruba/class-leak
Detect leaking classes
Maintainers
2.1.7
2026-06-10 12:34 UTC
Requires
- php: >=8.4
- entropy/entropy: ^0.3 || ^0.4
- nette/utils: ^4.1
- nikic/php-parser: ^5.7
- symfony/finder: ^7.4|^8.0
- webmozart/assert: ^2.0
Requires (Dev)
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^13.0
- rector/jack: ^1.0
- rector/rector: ^2.4
- symplify/easy-coding-standard: ^13.0
- symplify/phpstan-extensions: ^12
- tomasvotruba/unused-public: ^2.2
- tracy/tracy: ^2.12
Suggests
None
Provides
None
Conflicts
None
MIT d8c62dd42e26bc753fcac1f18225daccc5fc5380
This package is auto-updated.
Last update: 2026-06-10 12:34:45 UTC
README
Find leaking classes that you never use... and get rid of them.
Install
composer require tomasvotruba/class-leak --dev
Usage
Pass directories you want to check:
vendor/bin/class-leak check src
Make sure to exclude /tests directories, to keep reporting classes that are used in tests, but never used in the code-base.
Many types are excluded by default, as they're collected by framework magic, e.g. console command classes.
Exclude what you use
Do you want to skip classes of certain type?
vendor/bin/class-leak check src --skip-type="App\\Contract\\SomeInterface"
What if your classes do no implement any type?
vendor/bin/class-leak check src --skip-suffix="Controller"
Do you want to skip classes using a specific attribute?
vendor/bin/class-leak check src --skip-attribute="App\\Attribute\\AsController"
Happy coding!
