awps/loader
Composer 安装命令:
composer require awps/loader
包简介
Simple loader that is designed to work with both classes and normal PHP files.
README 文档
README
Loader
A simple loader that is designed to work with both classes and normal PHP files.
Installation
With composer:
composer require awps/loader
Manually:
require_once 'getloader.php';
Usage
Load PHP classes:
Awps\Loader::loadClasses( $path, $namespace );
This will autoload all PHP classes from $path and will assume that the namespace in those classes is $namespace;
Load simple PHP files:
Awps\Loader::loadFiles( $path, $pattern );
This will autoload all php files from $path that contains $pattern in their name.
Examples
// Autoload classes from `inc` folder and set the namespace to `Awesome` Awps\Loader::loadClasses( __DIR__ . 'inc', 'Awesome' ); // Now you can initialize a class. For example: new Awesome\Something(); // ------------------------------------------------------- // Include all php files from `functions` Awps\Loader::loadFiles( __DIR__ . 'functions', 'component-' ); // This one will include all php files that contains `component-` string in their name // from `functions` directory. // Now you may call a function defined in one of those files. For example: do_something_special();
统计信息
- 总下载量: 51
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-3.0
- 更新时间: 2017-12-18