library classloader
Auto loading the missing class while the file's name starts with lowercase char
qycloud/classloader
Auto loading the missing class while the file's name starts with lowercase char
- Tuesday, May 19, 2015
- by qycloud
- Repository
- 0 Watchers
- 1 Stars
- 583 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 1 Forks
- 0 Open issues
- 2 Versions
- 11 % Grown
ClassLoader:
ClassLoader is a tool to auto loading the missing class while the file's name starts with lowercase char., (*1)
Getting Started:
- Create composer.json file in root directory of your application:
{
"require": {
"php": ">=5.4.0",
"nanjingboy/classloader": "*"
}
}
Usage Example:
Imagine the following application structure:, (*2)
application
├── models
│ └─── user.php
If we want to access the class Models\User, we should register a classLoader like this:, (*3)
<?php
require __DIR__ . '/vendor/autoload.php';
$classLoader = new CloassLoader();
$classLoader->addPrefix('Models', __DIR__);
$classLoader->register();
License:
MIT, (*4)