lyzframework/directory-class-reader

Installs: 9

Dependents: 1

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/lyzframework/directory-class-reader

1.0.0 2023-11-05 21:11 UTC

This package is auto-updated.

Last update: 2025-10-06 01:42:24 UTC


README

This is a project to facilitate the reading of PHP classes from a directory.

composer require lyzframework/directory-class-reader

It contains two classes for this purpose:

  • ReaderFilesPHPDirectory: reads all PHP files from a directory recursively. Instantiate the class by passing the mandatory $directory parameter, and then call the getListFiles() method to retrieve the list of files.

  • ReaderClassDirectory: reads all files from a directory and retrieves the namespace so that you can instantiate the classes. Instantiate the class by passing the mandatory $readerFilesPHPDirectory parameter of type ReaderFilesPHPDirectory. After that, call the getListNamespace() method to retrieve an array with all the namespaces found.

A common use case is when you have a directory with several controllers that have routes mappings, and you want to retrieve all these controllers and perform a reflection treatment to extract the meta-information.