I would like to make my projects so fexible that one can simply copy+paste them into each other.
My project structure is ProjectName/(bin, config, lib).
After copy+paste I would have a chain like ProjectName1/lib/ProjectName2/lib/ProjectName3/.
Now it would be great if the Autoloader searches files acording to the level where the file is been called.
For example if a class within ProjectName1/lib/ProjectName2/lib/ calls "new Config" it should receive the config file located in ProjectName1/lib/ProjectName2/config/config.php.
(But not the one in ProjectName1/config/config.php and neither the on in ProjectName1/lib/ProjectName2/lib/ProjectName3/config/config.php).
Is there a way to do this?
Edit: Does it make sense to make files unique? For example: If 'config.php' was 'ProjectName2Config.php' there is (almost) no chance for conflicts. So the autoloader could search everywhere and will eventually find it's file.
Edit: Each project would have his own autoloader availible for copy+paste reasons. However I thought that I would load just the one for ProjectName1. Is it better to load them all so that each one can stay simple?
Cheers, Peter
PS: I just came back from a 3 years programming break. I am also happy, if you tell me that above is gennerally a bad idea and give me the reason why :-)