1. Go to this page and download the library: Download koriit/phpdeps 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/ */
koriit / phpdeps example snippets
namespace ACME\Lib\Modules\OtherModule;
use ACME\Lib\Modules\SomeModule\Exceptions\ObjectNotFound;
// ...
----
Then PHPDeps notices that *OtherModule* depends on *SomeModule*.
Once all modules are analyzed, PHPDeps creates a dependency graph and looks for any cycles in it.
== Basic usage
If you are all configured and set then just execute:
[source,shell]
----
vendor/bin/phpdeps
----
If your configuration file is not named `phpdeps.xml` then you can pass it as `--config` option:
[source,shell]
----
vendor/bin/phpdeps --config=myPHPDepsConfig.xml
----
It's suggested to add `phpdeps` call to scripts section in your `composer.json`:
[source,json]
----
"scripts": {
"dependencies": "phpdeps"
}
----
You can also run it alongside your tests:
[source,json]
----
"scripts": {
"test": ["phpunit", "phpdeps"]
}
----
== Example
Let's consider a simplified structure of PHPDeps itself:
----
/src/PHPDeps
|-- ExtCodes.php
|-- PHPDepsApplication.php
|-- /Commands/
|-- /Config/
|-- /Modules/
|-- /Helpers/
----
First, you need to prepare a configuration file that will allow PHPDeps to find your modules:
[source,xml,title="phpdeps.xml"]
----
<?xml version="1.0" encoding="UTF-8"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.