1. Go to this page and download the library: Download czproject/phpdepend library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
czproject / phpdepend example snippets
php
$phpdepend = new CzProject\PhpDepend\PhpDepend;
// file parsing
$phpdepend->parseFile('MyClass.php');
// code snippet parsing
$source = file_get_contents('MyClass.php');
$phpdepend->parse($source);
// getting result
$phpdepend->getClasses(); // returns list of defined classes, interfaces & traits
$phpdepend->getDependencies(); // returns list of
php
$phpdepend = new CzProject\PhpDepend\PhpDepend;
$phpdepend->parse('
class Greeting implements IGreeting
{
public function say($name)
{
if (!$name) {
throw new InvalidArgumentException("Invalid name");
}
return "Hello $name";
}
}
$greeting = new Greeting;
$greeting->say("John");
');
var_dump($phpdepend->getClasses());
/* Output:
array (1) {
'Greeting'
}
*/
var_dump($phpdepend->getDependencies());
/* Output:
array (3) {
'IGreeting',
'InvalidArgumentException',
'Greeting',
}
*/
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.