mirror of
https://github.com/danog/class-finder.git
synced 2024-11-30 04:29:03 +01:00
3.1 KiB
3.1 KiB
Version 0.3.0 Beta
- #3 Added support for "recursive mode". Invoking
ClassFinder::getClassesInNamespace()
in this mode will result in classes in subnamespaces being turned up.
<?php
require_once __DIR__ . '/vendor/autoload.php';
$classes = ClassFinder::getClassesInNamespace('TestApp1\Foo', ClassFinder::RECURSIVE_MODE);
/**
* array(
* 'TestApp1\Foo\Bar',
* 'TestApp1\Foo\Baz',
* 'TestApp1\Foo\Foo',
* 'TestApp1\Foo\Box\Bar',
* 'TestApp1\Foo\Box\Baz',
* 'TestApp1\Foo\Box\Foo',
* 'TestApp1\Foo\Box\Lon\Bar',
* 'TestApp1\Foo\Box\Lon\Baz',
* 'TestApp1\Foo\Box\Lon\Foo',
* )
*/
var_dump($classes);
- Added experimental support for classes that have been included via
files
entries incomposer.json
. Including this feature is a significant drain on performance, so it must be explicitly enabled.
<?php
require_once __DIR__ . '/vendor/autoload.php';
ClassFinder::enableExperimentalFilesSupport();
$classes = ClassFinder::getClassesInNamespace('TestApp1\Foo');
- PSR4 and Classmap features can now be disabled. Disabling autoloading features that you don't need will probably improve performance.
<?php
require_once __DIR__ . '/vendor/autoload.php';
ClassFinder::disablePSR4Support();
ClassFinder::disableClassmapSupport();
$classes = ClassFinder::getClassesInNamespace('TestApp1\Foo');
Version 0.2.0
- Added support for finding classes declared via
classmap
. - Exceptions will no longer be thrown when PSR4 can't find a registered namespace (because it could be a valid class
declared in a
classmap
)
Example composer.json that is now supported:
...
"autoload": {
...
"classmap": [ "src/foo/", "src/bar/" ]
}
...
Version 0.1.2
- Fixed composer.json so that it can be correctly installed on PHP 7+.
Version 0.1.1
- Fixed a Linux specific bug that caused absolute paths to fail to resolve and erroneously throw exceptions. If you were
affected by this bug, you would see errors like
Unknown namespace Acme\Whatever. Checked for files in , but that directory did not exist. [...]
when that namespace does indeed exist. - Support for PHP 5.3 is now under testing harness and should work now.
Version 0.1.0
- Vastly improved PSR4 support
- Loading classes from Composer packages is now supported.
- Namespaces that map to multiple directories is now supported.
- Fixed a bug where ClassFinder would use a more generic (and therefore wrong) namespace over a better one.
(Selecting
Acme
, whenAcme\Foo
is a better choice)
- Manually overriding the AppRoot is now done with a static method instead of a static property
Mapping a namespace to multiple directories:
...
"autoload": {
"psr-4": {
"Acme\\Foo\\": [ "src/", "srcButDifferent/" ]
}
}
...
Old overriding app root:
ClassFinder::appRoot = '/home/hpierce/whatevs';
New overriding app root:
ClassFinder::setAppRoot('/home/hpierce/whatevs');