Skip to content

Version 2.0.0

Compare
Choose a tag to compare
@BelleNottelling BelleNottelling released this 27 May 09:02
· 11 commits to main since this release
19c70b9

Breaking Changes

  • addPrefix has been renamed to addNamespace 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

Enhancements

  • You can now set stopIfNotFound to true 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 to none