PHPackages                             tomasvotruba/class-leak - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Testing &amp; Quality](/categories/testing)
4. /
5. tomasvotruba/class-leak

ActiveLibrary[Testing &amp; Quality](/categories/testing)

tomasvotruba/class-leak
=======================

Detect leaking classes

2.1.1(5mo ago)1351.7M—9.5%7[1 issues](https://github.com/TomasVotruba/class-leak/issues)20MITPHPPHP &gt;=7.2CI passing

Since Jul 17Pushed 5mo ago2 watchersCompare

[ Source](https://github.com/TomasVotruba/class-leak)[ Packagist](https://packagist.org/packages/tomasvotruba/class-leak)[ Fund](https://www.paypal.me/rectorphp)[ GitHub Sponsors](https://github.com/tomasvotruba)[ RSS](/packages/tomasvotruba-class-leak/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (87)Used By (20)

Class Leak
==========

[](#class-leak)

[![Downloads total](https://camo.githubusercontent.com/9deb787cb9851aff30f8742f531f3a0b7feec1d77363faf27cb98d4aacbe8fed/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d6173766f74727562612f636c6173732d6c65616b2e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/tomasvotruba/class-leak/stats)

Find leaking classes that you never use... and get rid of them.

Install
-------

[](#install)

```
composer require tomasvotruba/class-leak --dev
```

Usage
-----

[](#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
--------------------

[](#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!

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance69

Regular maintenance activity

Popularity56

Moderate usage in the ecosystem

Community31

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~10 days

Recently: every ~78 days

Total

85

Last Release

179d ago

Major Versions

0.2.16 → 1.0.02024-10-01

1.2.7 → 2.0.02024-12-12

PHP version history (2 changes)0.0.1PHP &gt;=8.1

0.0.6.72PHP &gt;=7.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/924196?v=4)[Tomas Votruba](/maintainers/TomasVotruba)[@TomasVotruba](https://github.com/TomasVotruba)

---

Top Contributors

[![TomasVotruba](https://avatars.githubusercontent.com/u/924196?v=4)](https://github.com/TomasVotruba "TomasVotruba (165 commits)")[![ruudk](https://avatars.githubusercontent.com/u/104180?v=4)](https://github.com/ruudk "ruudk (14 commits)")[![staabm](https://avatars.githubusercontent.com/u/120441?v=4)](https://github.com/staabm "staabm (14 commits)")[![Bellangelo](https://avatars.githubusercontent.com/u/9512427?v=4)](https://github.com/Bellangelo "Bellangelo (1 commits)")[![zairigimad](https://avatars.githubusercontent.com/u/9056839?v=4)](https://github.com/zairigimad "zairigimad (1 commits)")[![erjanmx](https://avatars.githubusercontent.com/u/4899432?v=4)](https://github.com/erjanmx "erjanmx (1 commits)")[![qroques](https://avatars.githubusercontent.com/u/22145593?v=4)](https://github.com/qroques "qroques (1 commits)")

---

Tags

dead-codephpstatic-analysisunused-classes

### Embed Badge

![Health badge](/badges/tomasvotruba-class-leak/health.svg)

```
[![Health](https://phpackages.com/badges/tomasvotruba-class-leak/health.svg)](https://phpackages.com/packages/tomasvotruba-class-leak)
```

###  Alternatives

[phpspec/prophecy

Highly opinionated mocking framework for PHP 5.3+

8.5k551.7M682](/packages/phpspec-prophecy)[brianium/paratest

Parallel testing for PHP

2.5k118.8M754](/packages/brianium-paratest)[beberlei/assert

Thin assertion library for input validation in business models.

2.4k96.9M570](/packages/beberlei-assert)[mikey179/vfsstream

Virtual file system to mock the real file system in unit tests.

1.4k108.0M2.7k](/packages/mikey179-vfsstream)[orchestra/testbench

Laravel Testing Helper for Packages Development

2.2k39.1M32.1k](/packages/orchestra-testbench)[phpspec/phpspec

Specification-oriented BDD framework for PHP 7.1+

1.9k36.7M3.1k](/packages/phpspec-phpspec)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
