Get the file in which the class was declared / required from

How can I get the file and line where the class was declared and / or required?

+8
php
source share
1 answer

Use Reflections to find out where the class was declared:

$reflector = new ReflectionClass('Foobar'); echo $reflector->getFileName(); echo $reflector->getStartLine(); 

Use inclued to find out what was included.

+16
source share

All Articles