PHPackages                             league/construct-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. league/construct-finder

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

league/construct-finder
=======================

Finds classes, interfaces, traits, and enums.

1.6.0(5mo ago)443.2M—0.5%512MITPHPPHP  ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0CI passing

Since Dec 30Pushed 5mo ago3 watchersCompare

[ Source](https://github.com/thephpleague/construct-finder)[ Packagist](https://packagist.org/packages/league/construct-finder)[ GitHub Sponsors](https://github.com/frankdejonge)[ RSS](/packages/league-construct-finder/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (13)Used By (12)

Construct Finder
================

[](#construct-finder)

This library helps you locate classes, interfaces, traits, and enums in PHP code. The construct finder locates all code constructs located in a directory.

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

[](#installation)

```
composer require league/construct-finder
```

Usage
-----

[](#usage)

### Finding constructs

[](#finding-constructs)

You can find all constructs or use a type specific finder.

```
use League\ConstructFinder\ConstructFinder;

// Find all constructs
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findAll();
$constructNames = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findAllNames();

// Find all classes
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findClasses();
$constructNames = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findClassNames()

// Find all interfaces
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findInterfaces();
$constructNames = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findInterfaceNames();

// Find all enums
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findEnums();
$constructNames = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findEnumNames();

// Find all traits
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findTraits();
$constructNames = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findTraitNames();
```

### Using a construct

[](#using-a-construct)

Constructs are simple value objects that expose the name and the type.

```
use League\ConstructFinder\Construct;
use League\ConstructFinder\ConstructFinder;
// Find all constructs
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')->findAll();

/** @var Construct $construct */
$construct = $constructs[0];

$name = $construct->name();
$name = (string) $construct;

$type = $construct->type(); // class, trait, interface, enum
```

### Finding in multiple directories

[](#finding-in-multiple-directories)

Provide multiple directories to search from in one go.

```
use League\ConstructFinder\ConstructFinder;

// Find all constructs
$constructs = ConstructFinder::locatedIn(
    __DIR__ . '/SomeDirectory',
    __DIR__ . '/AnotherDirectory',
)->findAll();
```

### Excluding files based on exclude patterns

[](#excluding-files-based-on-exclude-patterns)

All patterns are match in full. You can use a wildcard (`*`) for fuzzy matching.

```
use League\ConstructFinder\ConstructFinder;

// Find all constructs
$constructs = ConstructFinder::locatedIn(__DIR__ . '/SomeDirectory')
    ->exclude('*Test.php', '*/Tests/*')
    ->findAll();
```

###  Health Score

60

—

FairBetter than 99% of packages

Maintenance72

Regular maintenance activity

Popularity53

Moderate usage in the ecosystem

Community27

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 64.7% 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 ~144 days

Recently: every ~297 days

Total

11

Last Release

156d ago

PHP version history (6 changes)1.0.0PHP ~8.0 || ~8.1 || ~7.4

1.0.1PHP ~8.0.0 || ~8.1.0 || ~7.4.0

1.2.2PHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~7.4.0

1.3.0PHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~7.4.0

1.5.0PHP ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~7.4.0

1.6.0PHP  ~7.4.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/534693?v=4)[Frank de Jonge](/maintainers/frankdejonge)[@frankdejonge](https://github.com/frankdejonge)

---

Top Contributors

[![frankdejonge](https://avatars.githubusercontent.com/u/534693?v=4)](https://github.com/frankdejonge "frankdejonge (33 commits)")[![colinodell](https://avatars.githubusercontent.com/u/202034?v=4)](https://github.com/colinodell "colinodell (7 commits)")[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (6 commits)")[![shyim](https://avatars.githubusercontent.com/u/6224096?v=4)](https://github.com/shyim "shyim (2 commits)")[![mitelg](https://avatars.githubusercontent.com/u/6985627?v=4)](https://github.com/mitelg "mitelg (1 commits)")[![GrahamCampbell](https://avatars.githubusercontent.com/u/2829600?v=4)](https://github.com/GrahamCampbell "GrahamCampbell (1 commits)")[![shadowhand](https://avatars.githubusercontent.com/u/38203?v=4)](https://github.com/shadowhand "shadowhand (1 commits)")

---

Tags

php

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/league-construct-finder/health.svg)

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

###  Alternatives

[vrana/jush

JUSH - JavaScript Syntax Highlighter

272.7M9](/packages/vrana-jush)

PHPackages © 2026

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