nanjingboy / classloader
Auto loading the missing class while the file's name starts with lowercase char
v0.1.1
2014-12-16 02:10 UTC
Requires
- php: >=5.4.0
This package is not auto-updated.
Last update: 2024-11-05 03:07:37 UTC
README
ClassLoader:
ClassLoader is a tool to auto loading the missing class while the file's name starts with lowercase char.
Getting Started:
- Create composer.json file in root directory of your application:
{ "require": { "php": ">=5.4.0", "nanjingboy/classloader": "*" } }
- Install it via composer
Usage Example:
Imagine the following application structure:
application
├── models
│ └─── user.php
If we want to access the class Models\User, we should register a classLoader like this:
<?php require __DIR__ . '/vendor/autoload.php'; $classLoader = new CloassLoader(); $classLoader->addPrefix('Models', __DIR__); $classLoader->register();
License:
MIT