I need to know the path of a file in which an interface is defined. I know the name and the interface is available (the file was included at another location in the code). I know things like __FILE__, etc. but the point is, it's only an interface, i do not have an instance. Ironically, i need the path to find a suitable implementation for the interface.
Does anyone know a way to find the path?
Thanks for your help!
Despite the name, ReflectionClass works on interfaces too. So you can use
$interface = new ReflectionClass('IFoo');
echo $interface->getFilename();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With