Skip to content

wwtg99/class_loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Class Loader

Description

Load class file automatically with namespace. Based on Symfony Psr4ClassLoader.

Usage

If directory is as below:

  • src
    • TestClass
      • Test1.php (Class Test1, namespace TestClass)
      • Sub
        • Test2.php (Class Test2, namespace TestClass\Sub
$register_path =[
    ['TestClass', 'TestClass', true], //[prefix, path, recursive], directory with first letter upper case will be loaded recursively.
];
$loader = new \ClassLoader\Loader(*path_to_src*, $register_path);
$loader->autoload();
// Class Test1 and Test2 do not need require
$test1 = new \TestClass\Test1();
$test2 = new \TestClass\Sub\Test2();

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages