Is there any way to get the file where a class was instantiated in auto-loading features in PHP?

37 views Asked by At

Its similar question of Is there an easy way to get the file where a class was instantiated in PHP? but with different approach.

I need to know the source in autoloading (__autoload() or spl_autoload()) functions so that I can load right class of sub-namespacing

Lets illustrate my problem a little bit by an example - Please consider my following classes: /my/project/root/faculties/faculty.class.php [namespace: faculties] /my/project/root/faculties/faculty1/faculty.class.php [namespace: faculties/faculty1] /my/project/root/faculties/completely/different/project/at/deep/project/root/faculties/faculty.class.php [namespace: faculties]

Now if I want to access instance of that different project its conflict with root project cause its same namespace.

0

There are 0 answers