Skip to content

Instantly share code, notes, and snippets.

@chriscalip
Created March 15, 2019 20:58
Show Gist options
  • Save chriscalip/063140aa4b64310d79811af687095b93 to your computer and use it in GitHub Desktop.
Save chriscalip/063140aa4b64310d79811af687095b93 to your computer and use it in GitHub Desktop.
PHP: how to get a list of classes that implement certain interface?
<?php
$targetMiners = array_values(array_filter(get_declared_classes(), function ($className) {
return in_array('App\Contracts\MinerInterface', class_implements($className));
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment