I believe that you have a good reason for saving classes and subclasses in different folders on your file system, but consider loading classes based on Zend autoload or namespace - this will not work in your case ...
Instead of having this architecture:
classes | - abstracts | - AbstractClass1.php | - AbstractClass2.php | - children | - ChildClass1.php | - ChildClass2.php
consider this:
classes | - AbstractClass1.php | - AbstractClass2.php | - AnotherClass.php | - AbstractClass1 | - ChildClass1.php | - ChildClass12.php | - AbstractClass2 | - ChildClass2.php | - ChildClass22.php | - AnotherClass | - ClassA.php | - ClassB.php | - ClassB | - ClassBA.php
In this architecture, it is clear that ClassBA , which is in the classes/AnotherClass/ClassB path, extends ClassB , which extends AnotherClass . Now you can use namespaces (when using PHP 5.3 or lt;) or by naming your classes, for example class AnotherClass_ClassB_ClassBA { ... } (Zend class naming convention). You can use the Zend autoloader (e.g..) ...
source share