2017 © Pedro Peláez
 

library psr4list

Returns the name of the classes in PSR4 path

image

koriym/psr4list

Returns the name of the classes in PSR4 path

  • Wednesday, February 11, 2015
  • by koriym
  • Repository
  • 1 Watchers
  • 0 Stars
  • 30,746 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 8 % Grown

The README.md

Koriym.Psr4List

Scrutinizer Code Quality Code Coverage Continuous Integration (legacy), (*1)

Koriym\Psr4List is a simple library for retrieving a list of all classes and files corresponding to a specified namespace prefix and directory, based on the PSR-4 autoloading standard., (*2)


Installation

You can install the library via Composer:, (*3)

composer require koriym/psr4list

Usage

Here’s a basic example of how to use Koriym\Psr4List:, (*4)

use Koriym\Psr4List\Psr4List;

$list = new Psr4List;
$prefix = 'BEAR\Sunday'; // Namespace prefix
$path = __DIR__ . '/src'; // Corresponding directory

foreach ($list($prefix, $path) as list($class, $file)) {
    echo "Class: $class\n";
    echo "File: $file\n";
}

Example Output

Class: BEAR\Sunday\Module\AppModule
File: /path/to/project/src/Module/AppModule.php
Class: BEAR\Sunday\Extension\Router\RouterInterface
File: /path/to/project/src/Extension/Router/RouterInterface.php

Features

  • PSR-4 Compliant: Works based on the PSR-4 autoloading standard.
  • Simple and Lightweight: Minimal dependencies, easy to integrate into any project.
  • Flexible: Perfect for enumerating classes within a specific namespace.

Use Cases

  • Enumerate all classes under a specific namespace in your project.
  • Verify the correspondence between classes and their files.
  • Use as part of refactoring or code analysis tools.

License

This library is licensed under the MIT License., (*5)

The Versions

11/02 2015

dev-develop

dev-develop

Returns the name of the classes in PSR4 path

  Sources   Download

BSD-3-Clause

psr4

07/12 2014

dev-master

9999999-dev

Returns the name of the classes in PSR4 path

  Sources   Download

BSD-3-Clause

psr4

07/12 2014

1.0

1.0.0.0

Returns the name of the classes in PSR4 path

  Sources   Download

BSD-3-Clause

psr4