PHPackages                             alex-oleshkevich/classnames - 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. alex-oleshkevich/classnames

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

alex-oleshkevich/classnames
===========================

A missing class name extractor from PHP files.

1.2(6y ago)027.9k1MITPHPPHP &gt;=5.4

Since Nov 5Pushed 6y ago1 watchersCompare

[ Source](https://github.com/alex-oleshkevich/classnames)[ Packagist](https://packagist.org/packages/alex-oleshkevich/classnames)[ Docs](https://github.com/alex-oleshkevich/classnames)[ RSS](/packages/alex-oleshkevich-classnames/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (3)Used By (1)

PHP Class\\Interface\\Trait names extractor from files.
=======================================================

[](#php-classinterfacetrait-names-extractor-from-files)

This library extracts entity names from php files.
Supports plain classes, multiple entity per file, classes within curly namespaces, etc.

[![Build Status](https://camo.githubusercontent.com/94023d0116ba31945e3ba7fcaf6a0616b62f05b0b7ad5fd8aef60832f07f696d/68747470733a2f2f7472617669732d63692e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732e737667)](https://camo.githubusercontent.com/94023d0116ba31945e3ba7fcaf6a0616b62f05b0b7ad5fd8aef60832f07f696d/68747470733a2f2f7472617669732d63692e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732e737667)[![Latest Stable Version](https://camo.githubusercontent.com/9238fa9820d131aa4ff4d0f41661c4e2b33be4ed56255e3c85a7b8224a186de8/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732f762f737461626c653f31)](https://packagist.org/packages/alex-oleshkevich/classnames)[![Monthly Downloads](https://camo.githubusercontent.com/d5159f88813fe05a0bb5e4e6957c284578f76a668d7b033647034a0e558446c8/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732f642f6d6f6e74686c793f31)](https://packagist.org/packages/alex-oleshkevich/classnames)[![Total Downloads](https://camo.githubusercontent.com/8224e27f17cf7cb08b54f0aa8a14493c77a3a03a37281f87d358754a999d20cc/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732f646f776e6c6f6164733f31)](https://packagist.org/packages/alex-oleshkevich/classnames)[![Latest Unstable Version](https://camo.githubusercontent.com/eef0eb7dd57ba6651d24b2545889aa767e6c219ca647e332103f926e771ce98a/68747470733a2f2f706f7365722e707567782e6f72672f616c65782d6f6c6573686b65766963682f636c6173736e616d65732f762f756e737461626c653f31)](https://packagist.org/packages/alex-oleshkevich/classnames)[![Deps. Status](https://camo.githubusercontent.com/dc65891a2933a07b1e4c97d3013fe8f792abfbf4da2b54160931f4383517a479/68747470733a2f2f7777772e76657273696f6e6579652e636f6d2f757365722f70726f6a656374732f3537653362316564366466636430303034326134663638362f62616467652e7376673f7374796c653d666c61742d737175617265)](https://www.versioneye.com/user/projects/57e3b1ed6dfcd00042a4f686)

### Installation

[](#installation)

```
composer install alex-oleshkevich/classnames
```

### Example

[](#example)

```
$extractor = new \ClassNames\ClassNames;
$classes = $extractor->getClassNames('/path/to/file.php');
// or
$interfaces = $extractor->getInterfaceNames('/path/to/file.php');
// or
$traits = $extractor->getTraitNames('/path/to/file.php');
```

All functions listed above return a plain array of found entities.

```
// file "/path/to/file.php"
namespace TestAsset {
    class Asset {}
    class Asset2 {}
}

$extractor = new \ClassNames\ClassNames;
$classes = $extractor->getClassNames('/path/to/file.php');
print_r($classes);
/**
* Array
* (
*     [0] => TestAsset\Asset
*     [1] => TestAsset\Asset2
* )
*/
```

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

2380d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/cc63879c46ac0cb6aa7a73481f7e651d327e17f1ecf4c12435c4a5eb67608297?d=identicon)[alex.oleshkevich](/maintainers/alex.oleshkevich)

---

Top Contributors

[![alex-oleshkevich](https://avatars.githubusercontent.com/u/635848?v=4)](https://github.com/alex-oleshkevich "alex-oleshkevich (1 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/alex-oleshkevich-classnames/health.svg)

```
[![Health](https://phpackages.com/badges/alex-oleshkevich-classnames/health.svg)](https://phpackages.com/packages/alex-oleshkevich-classnames)
```

###  Alternatives

[jeroen/rewindable-generator

Provides a simple adapter to make generators rewindable

1655.4k2](/packages/jeroen-rewindable-generator)

PHPackages © 2026

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