PHPackages                             kafkiansky/discovery - 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. kafkiansky/discovery

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

kafkiansky/discovery
====================

Discover interfaces, traits and classes from application autoload classmap.

v0.5.0(4y ago)114.8kMITPHPPHP ^8.1

Since May 15Pushed 4y ago1 watchersCompare

[ Source](https://github.com/kafkiansky/discovery)[ Packagist](https://packagist.org/packages/kafkiansky/discovery)[ RSS](/packages/kafkiansky-discovery/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependencies (2)Versions (6)Used By (0)

PHP Discovery
=============

[](#php-discovery)

[![test](https://github.com/kafkiansky/discovery/workflows/test/badge.svg?event=push)](https://github.com/kafkiansky/discovery/workflows/test/badge.svg?event=push)[![Software License](https://camo.githubusercontent.com/55c0218c8f8009f06ad4ddae837ddd05301481fcf0dff8e0ed9dadda8780713e/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d627269676874677265656e2e7376673f7374796c653d666c61742d737175617265)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/cf822bb7243bb616bdb5324425453f20cc38d9cc8c0c3415e28980a7653bfc45/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6b61666b69616e736b792f646973636f766572792e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/kafkiansky/discovery)

### Contents

[](#contents)

- [Installation](#installation)
- [Usage](#usage)
    - [ClassImplements](#class-implements)
    - [ClassExtends](#class-extends)
    - [ClassUses](#class-uses)
    - [ClassHasAttributes](#class-has-attributes)
    - [All](#all)
    - [Any](#any)
    - [None](#none)
- [Loader constraints](#loader-constraints)
- [Composer loader](#composer-loader)
- [Array loader](#array-loader)
- [Performance optimization](#performance-optimization)
- [Testing](#testing)
- [License](#license)

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

[](#installation)

```
composer require kafkiansky/discovery
```

Usage
-----

[](#usage)

It is often necessary to find all classes that implement specific interface(s), inherit a specific class or use specific traits. This information could be used, in example, to implement autowiring in IOC containers. To avoid parsing the entire project, you could use classes information from the `autoload_classmap.php` file that the `composer` uses for [optimization](https://getcomposer.org/doc/articles/autoloader-optimization.md).

### Class Implements

[](#class-implements)

Discover all classes that implement specific interface(s):

```
