backendtea/dependency-finder

Find out exactly what classes depend on what other classes

0.0.2 2019-08-10 20:56 UTC

This package is auto-updated.

Last update: 2024-04-11 19:11:13 UTC


README

What is this

This library allows you to find the dependencies of a php file.

It was created to help with another libary, that allows you to run tests for only changes files (and their dependencies)

Usage

<?php
require_once __DIR__.'/vendor/autoload.php';

use Depend\DependencyFinder;


$finder = new DependencyFinder([__DIR__.'/src/',  './vendor/psr/container/src', __DIR__.'/tests']);

$finder->build();

$deps = $finder->getAllFilesDependingOn(['./tests/Fixtures/Circular/A.php']);

foreach ($deps as $dep) {
    var_dump($dep);
}

$finder->reBuild(['./src/Domain/User.php', './tests/Domain/User.php', './src/functions.php']);