I'm trying to split my lib folder into a few folders. I thought that prefixes in autoloader should be the most balanced method between code writing and performance. The problem is that I need to rename every file and every class name inside to match the name with prefix included.
Before:
-app
----lib
-------Class1.php
-------Class2.php
-------Class3.php
After how it must be to work:
-app
----lib
--------general
-----------General_Class1.php
-----------General_Class2.php
--------app
-----------App_Class3.php
After how I want it to be:
-app
----lib
--------general
-----------Class1.php
-----------Class2.php
--------app
-----------Class3.php
Right now to register those prefixes I'm using the following code:
// Register some prefixes
$loader->registerPrefixes(
array(
"App_" => $config->application->libraryDir . "app/",
"General_" => $config->application->libraryDir . "general/",
)
);
$loader->register();
$server = new App_Class3();
echo $server->testMethod('test');
It it possible to call certain classes with for example App_Class3 but without renaming the file and the class name inside (using prefixes method or similar)?