marshung / autoloader
在开发过程中提供服务的自动加载
1.0.4
2018-06-24 14:19 UTC
This package is auto-updated.
Last update: 2024-09-20 04:20:34 UTC
README
说明
提供各模块路径映射,以实现自动加载类文件-模拟已安装状态
用法
- 安装marshung/autoloader
$ composer require marshung/autoloader 1.*
- 在与vendor同层目录中建立文件autoload.conf.php
- 设置路径映射数组$pathMap
- 格式:$pathMap[$namePath] = $dirPatch;
- 执行此autoloader,如果使用框架,可以在框架设置文件中配置自动执行
// CodeIgniter: application/config/config.php
$config['enable_hooks'] = TRUE;
// CodeIgniter: application/config/hooks.php
$hook['pre_system'][] = [new \marshung\Autoloader, 'autoloader'];
// Manual call
\marshung\Autoloader::autoloader();