"php: how to get a list of classes that implement certain interface?" Answer’s

0

You can use PHP's ReflectionClass::implementsInterface and get_declared_classes functions to accomplish this:

$classes = get_declared_classes();
$implementsIModule = array();
foreach($classes as $klass) {
   $reflect = new ReflectionClass($klass);
   if($reflect->implementsInterface('IModule')) 
      $implementsIModule[] = $klass;
}
Wednesday, March 31, 2021
 
Zulakis
answered 10 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :
 
Share