PHPackages                             kcs/class-finder - 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. kcs/class-finder

ActiveLibrary

kcs/class-finder
================

Utility classes to help discover other classes/namespaces

0.6.1(1y ago)311.5M↓21.8%6[2 issues](https://github.com/alekitto/class-finder/issues)13MITPHPPHP ^8.1CI passing

Since Jan 11Pushed 1y ago3 watchersCompare

[ Source](https://github.com/alekitto/class-finder)[ Packagist](https://packagist.org/packages/kcs/class-finder)[ GitHub Sponsors](https://github.com/alekitto)[ RSS](/packages/kcs-class-finder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (11)Versions (21)Used By (13)

ClassFinder
===========

[](#classfinder)

Utility classes to help discover other classes/namespaces

[![Tests](https://github.com/alekitto/class-finder/workflows/Tests/badge.svg)](https://github.com/alekitto/class-finder/workflows/Tests/badge.svg)[![codecov](https://camo.githubusercontent.com/73f76aed1f570ca78e1ecf632741ded272ef6e56915f6c8e2632e2bf052161a6/68747470733a2f2f636f6465636f762e696f2f67682f616c656b6974746f2f636c6173732d66696e6465722f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/alekitto/class-finder)

---

Installation
------------

[](#installation)

```
$ composer require kcs/class-finder
```

Usage
-----

[](#usage)

Finder helps you to discover classes into your project.

The most common way to discover is to use the provided `ComposerFinder`. This will search for classes using the auto-generated class loader from composer and resolving PSR-\* namespaces accordingly.

Read more in the docs at

### Basic usage

[](#basic-usage)

```
use Kcs\ClassFinder\Finder\ComposerFinder;

$finder = new ComposerFinder();
foreach ($finder as $className => $reflector) {
    // Do magic things...
}
```

### Filtering

[](#filtering)

You can filter classes using the methods exposed by `FinderInterface`:

- `implementationOf(array $interfaces)`: Finds the classes that implements all the given interfaces. You can pass a single interface as string.
- `subclassOf(string $superClass)`: Finds all the classes that are subclasses of the given class.
- `annontatedBy(string $annotationClass)`: Finds all the classes that have the given annotation in the class docblock.
- `withAttribute(string $attributeClass)`: Finds all the classes that have the given attribute applied on the class (PHP &gt;= 8.0) only.
- `in(array $dirs)`: Searches only in given directories.
- `inNamespace(array $namespaces)`: Searches only in given namespaces.
- `filter(callable $callback)`: Custom filtering callback.
- `pathFilter(callable $callback)`: Custom filtering callback for loading files.

License
-------

[](#license)

This library is released under the MIT license.

Contributions
-------------

[](#contributions)

Contributions are always welcome. Please feel free to open a PR or file an issue.

---

Thank you for reading
A.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance42

Moderate activity, may be stable

Popularity52

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity71

Established project with proven stability

 Bus Factor1

Top contributor holds 95% 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 ~136 days

Recently: every ~46 days

Total

20

Last Release

452d ago

PHP version history (4 changes)0.1PHP ^7.1

0.2.0PHP ^7.4|^8.0

0.3.1PHP ^8.0

0.4.0PHP ^8.1

### Community

Maintainers

![](https://www.gravatar.com/avatar/73dd7f3bebd03ec946b6b12359141ea461b770c3671acac4e8004e3c2d78e78f?d=identicon)[alekitto](/maintainers/alekitto)

---

Top Contributors

[![alekitto](https://avatars.githubusercontent.com/u/1257206?v=4)](https://github.com/alekitto "alekitto (96 commits)")[![alleknalle](https://avatars.githubusercontent.com/u/5603434?v=4)](https://github.com/alleknalle "alleknalle (1 commits)")[![lemorragia](https://avatars.githubusercontent.com/u/3736365?v=4)](https://github.com/lemorragia "lemorragia (1 commits)")[![massimilianobraglia](https://avatars.githubusercontent.com/u/17158942?v=4)](https://github.com/massimilianobraglia "massimilianobraglia (1 commits)")[![mpyw](https://avatars.githubusercontent.com/u/1351893?v=4)](https://github.com/mpyw "mpyw (1 commits)")[![szepeviktor](https://avatars.githubusercontent.com/u/952007?v=4)](https://github.com/szepeviktor "szepeviktor (1 commits)")

---

Tags

class-discoveryclass-findernamespaces-php

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/kcs-class-finder/health.svg)

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

###  Alternatives

[sabberworm/php-css-parser

Parser for CSS Files written in PHP

1.8k191.2M65](/packages/sabberworm-php-css-parser)[infection/infection

Infection is a Mutation Testing framework for PHP. The mutation adequacy score can be used to measure the effectiveness of a test set in terms of its ability to detect faults.

2.2k26.2M1.8k](/packages/infection-infection)[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

22.8k69.3k](/packages/grumpydictator-firefly-iii)[rebing/graphql-laravel

Laravel wrapper for PHP GraphQL

2.2k7.1M26](/packages/rebing-graphql-laravel)[humbug/php-scoper

Prefixes all PHP namespaces in a file or directory.

7963.0M35](/packages/humbug-php-scoper)[humbug/box

Fast, zero config application bundler with PHARs.

1.3k801.5k69](/packages/humbug-box)

PHPackages © 2026

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