Version 2.0.0
Breaking Changes
addPrefix
has been renamed toaddNamespace
to better fit it's actual use-case.- AntLoader is now configured by passing an array when constructing it.
Example using all available configuration options (all are optional):
$config = [
'mode' => 'auto', // Can be 'auto', 'filesystem', 'apcu', or 'none'.
'path' => '/path/to/save/classmap.php', // Where should AntLoader store the classmap if the file system cache option is used.
'key' => 'customApcuKey', // The APCu key used when storing the classmap. This does not usually need to be overridden.
'ttl' => 3600, // Allows you to set the time to live when using APCu. Value is in seconds.
'stopIfNotFound' => true // Setting this to true will cause AntLoader to stop looking for a class if it is not found in the classmap. By default it will look in the search directories you defined with `addNamespace`.
];
$loader = new AntCMS\AntLoader($config);
New Features
- New support for APCu to allow for storing the classmap in-memory, improving potential speed and responsiveness of the auto loader.
- New function
resetClassMap
to make it easy to remove the current classmap. This is recommended whenever you update your application.
Enhancements
- You can now set
stopIfNotFound
totrue
if you want AntLoader to stop looking for classes if they aren't found using the classmap.
Changes
- Simply passing an empty path to AntLoader will not longer prevent it from using the system file path to cache the classmap. AntLoader will now simply create a unique key and store it in the system's temporary directory. This file will be persistent and re-used until the OS's garbage collection deletes it or you call
resetClassMap
.- To explicitly turn off the classmap functionality, set
mode
tonone
- To explicitly turn off the classmap functionality, set