tomasvotruba / class-leak
Detect leaking classes
Requires
- php: >=7.4
- entropy/entropy: ^0.4.28
- nikic/php-parser: ^5.9
- symfony/polyfill-php80: ^1.31
Requires (Dev)
- php-parallel-lint/php-parallel-lint: ^1.4
- phpstan/extension-installer: ^1.4
- phpstan/phpstan: ^2.2
- phpunit/phpunit: ^9.6
- rector/jack: ^1.0
- rector/rector: ^2.4
- shipmonk/dead-code-detector: ^1.4
- symplify/easy-coding-standard: ^13.0
- symplify/phpstan-extensions: ^12
- tracy/tracy: ^2.12
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 2.3.5
- 2.3.4
- 2.3.3
- 2.3.2
- 2.3.1
- 2.3.0
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.8
- 2.1.7
- 2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- 2.0.5
- 2.0.4
- 2.0.3
- 2.0.2
- 2.0.1
- 2.0.0
- 1.2.7
- 1.2.6
- 1.2.5
- 1.2.4
- 1.2.3
- 1.2.2
- 1.2.1
- 1.2.0
- 1.1.2
- 1.1.1
- 1.1.0
- 1.0.3
- 1.0.2
- 1.0.1
- 1.0.0
- 0.2.16
- 0.2.15
- 0.2.14
- 0.2.13
- 0.2.12
- 0.2.11
- 0.2.10
- 0.2.9
- 0.2.8
- 0.2.7
- 0.2.6
- 0.2.5
- 0.2.4
- 0.2.3
- 0.2.2
- 0.2.1
- 0.2.0
- 0.1.3
- 0.1.2.72
- 0.1.2
- 0.1.1.72
- 0.1.1
- 0.1.0.72
- 0.1.0
- 0.0.22.72
- 0.0.22
- 0.0.21.72
- 0.0.21
- 0.0.20.72
- 0.0.20
- 0.0.19.72
- 0.0.19
- 0.0.18.72
- 0.0.18
- 0.0.17.72
- 0.0.17
- 0.0.16.72
- 0.0.16
- 0.0.15.72
- 0.0.15
- 0.0.14.72
- 0.0.14
- 0.0.13.72
- 0.0.13
- 0.0.12.72
- 0.0.12
- 0.0.11.72
- 0.0.11
- 0.0.10
- 0.0.9.72
- 0.0.9
- 0.0.8.72
- 0.0.8
- 0.0.7.72
- 0.0.7
- 0.0.6.72
- 0.0.6
- 0.0.5
- 0.0.4
- 0.0.3
- 0.0.2
- 0.0.1
- dev-tighten-blink-parity-1pct
- dev-php-bucket-traits
- dev-tighten-blink-parity-3pct
- dev-reduce-check-output-spacing
- dev-tighten-blink-parity-5pct
- dev-tighten-blink-parity-threshold
- dev-scan-shebang-console-files
- dev-skip-messenger-transport-factory
This package is auto-updated.
Last update: 2026-10-11 17:45:39 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"
Classes ending with Controller, Test or TestCase are skipped by default, as they are called by the router or the test runner. What if your other classes do no implement any type?
vendor/bin/class-leak check src --skip-suffix="Handler"
Do you want to skip classes using a specific attribute?
vendor/bin/class-leak check src --skip-attribute="App\\Attribute\\AsController"
Fast mode (Go port, experimental)
A Go port of the same checks is included as a proof of concept. Enable it with --blink:
vendor/bin/class-leak check src --blink
It reuses the same options and output. The bin/class-leak-go launcher builds the binary on first run, so a Go toolchain is required.
Happy coding!