mia3 / koseki
Library to quickly find classes that implement specific interfaces
Installs: 48
Dependents: 0
Suggesters: 0
Security: 0
Stars: 6
Watchers: 4
Forks: 1
Open Issues: 0
Type:composer-plugin
This package is auto-updated.
Last update: 2024-11-05 18:39:10 UTC
README
This library helps you to quickly and easily find classes that implement an interface or extend from a base class. It uses the registered interfaces of composer to find/build the registry. The registry itself is cached in the temporary directory returned by "sys_get_temp_dir()". The cache entry will automatically be recached if the the composer autoload_file changes. But it can does not pick up new/changes files, for development you should use the parameter "forceRecache". it's still wicked fast.
Usage cached
$implementations = ClassRegister::getImplementations('Acme\Package\MyCoolInterface');
Usage with forceRecache
$implementations = ClassRegister::getImplementations('Acme\Package\MyCoolInterface', TRUE);
That's it :)
Installation
composer require mia3/koseki
Ignoring incompatible/failing files
There are 2 choices where you can specify files that should be ignored by the ClassRegistry.
.koseki-ignore
.gitattributes
The syntax is based on the common .gitignore format: https://git-scm.com/docs/gitignore#_pattern_format
The ClassRegister will automatically add a file to the root .koseki-ignore
file if it
encounters a fatal error while including a class file.