Try ReflectionClass
- ReflectionClass::getFileName — Gets a filename
Example:
class Foo {}
$reflector = new \ReflectionClass('Foo');
echo $reflector->getFileName();
This will return false when the filename cannot be found, e.g. on native classes.