2017 © Pedro Peláez
 

library class-finder

Utility classes to help discover other classes/namespaces

image

kcs/class-finder

Utility classes to help discover other classes/namespaces

  • Friday, January 19, 2018
  • by alekitto
  • Repository
  • 1 Watchers
  • 0 Stars
  • 436 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 75 % Grown

The README.md

ClassFinder

Utility classes to help discover other classes/namespaces, (*1)

Tests codecov, (*2)


Installation

$ composer require kcs/class-finder

Usage

Finder helps you to discover classes into your project., (*3)

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., (*4)

Read more in the docs at https://alekitto.github.io/class-finder/, (*5)

Basic usage

use Kcs\ClassFinder\Finder\ComposerFinder;

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

Filtering

You can filter classes using the methods exposed by FinderInterface:, (*6)

  • 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 >= 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

This library is released under the MIT license., (*7)

Contributions

Contributions are always welcome. Please feel free to open a PR or file an issue., (*8)


Thank you for reading
A., (*9)

The Versions

19/01 2018

dev-master

9999999-dev

Utility classes to help discover other classes/namespaces

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Alessandro Chitolina

19/01 2018

0.1.2

0.1.2.0

Utility classes to help discover other classes/namespaces

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Alessandro Chitolina

17/01 2018

0.1.1

0.1.1.0

Utility classes to help discover other classes/namespaces

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Alessandro Chitolina

11/01 2018

0.1

0.1.0.0

Utility classes to help discover other classes/namespaces

  Sources   Download

MIT

The Requires

  • php ^7.1

 

The Development Requires

by Alessandro Chitolina