PHP code example of mike-roetgers / dependency-graph
1. Go to this page and download the library: Download mike-roetgers/dependency-graph 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/ */
mike-roetgers / dependency-graph example snippets
$op1 = new GenericOperation(1);
$op2 = new GenericOperation(2);
$op3 = new GenericOperation(3);
$op4 = new GenericOperation(4);
$dm = new DependencyManager();
$dm->addOperation($op1)->addOperation($op2)->addOperation($op3)->addOperation($op4);
$dm->addDependencyByOperation($op1, $op2);
$dm->addDependencyByOperation($op1, $op3);
$dm->addDependencyByOperation($op2, $op4);
$dm->addDependencyByOperation($op3, $op4);
$op1 = new GenericOperation(1);
$op2 = new GenericOperation(2);
$op3 = new GenericOperation(3);
$dm = new DependencyManager();
$dm->addOperation($op1)->addOperation($op2)->addOperation($op3);
$dm->addDependencyByOperation($op1, $op2);
$dm->addDependencyByOperation($op2, $op3);
$dm->addDependencyByOperation($op3, $op1);
$setupOperation1 = new GenericOperation('Setup1');
$setupOperation1->addTag('setup');
$setupOperation2 = new GenericOperation('Setup2');
$setupOperation2->addTag('setup');
$downstreamOperation = new GenericOperation('Downstream');
$dm = new DependencyManager();
$dm->addOperation($setupOperation1)->addOperation($setupOperation2)->addOperation($downstreamOperation);
$dm->addDependencyByTag('setup', $downstreamOperation); // execute all setup operations first
$dm->addDependencyByTag($downstreamOperation, 'setup'); // downstream is a dependency for all operations tagged with "setup"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.