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. [Utility &amp; Helpers](/categories/utility)
4. /
5. kcs/class-finder

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

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

Utility classes to help discover other classes/namespaces

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

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 2w 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

50

—

FairBetter than 95% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity52

Moderate usage in the ecosystem

Community28

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

543d 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

[grumpydictator/firefly-iii

Firefly III: a personal finances manager.

24.3k69.5k](/packages/grumpydictator-firefly-iii)[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.2k30.0M2.9k](/packages/infection-infection)[nuwave/lighthouse

A framework for serving GraphQL from Laravel

3.5k12.2M128](/packages/nuwave-lighthouse)[firefly-iii/data-importer

Firefly III Data Import Tool.

8165.8k](/packages/firefly-iii-data-importer)[keepsuit/laravel-opentelemetry

OpenTelemetry integration for laravel

173666.7k1](/packages/keepsuit-laravel-opentelemetry)[laragraph/utils

Utilities for using GraphQL with Laravel

2216.1M11](/packages/laragraph-utils)

PHPackages © 2026

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