Extracts list of dependencies (classes, interfaces & traits) from PHP file or code snippet.
$phpdepend = new Cz\PhpDepend;
$phpdepend->parseFile('MyClass.php');
/* or use
$source = file_get_contents('MyClass.php');
$phpdepend->parse($source);
*/
// returns list of defined classes, interfaces & traits
var_dump($phpdepend->getClasses());
// returns list of required classes, interfaces & traits
var_dump($phpdepend->getDependencies());
Download a latest package or use Composer:
composer require czproject/phpdepend
PHPDepend requires PHP 5.3.0 or later and enabled Tokenizer extension (enabled by default from PHP 4.3.0).
License: New BSD License
Author: Jan Pecha, http://janpecha.iunas.cz/