PHP code example of pyrex-fwi / plantuml

1. Go to this page and download the library: Download pyrex-fwi/plantuml 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/ */

    

pyrex-fwi / plantuml example snippets


#test-1.php


    //create document
    $wbs = new WorkBreakdownStructure('RootNode');
    
    //add subitems
    $wbs->addNode(new Node('Node A'));
    $wbs->addNode(new Node('Node B'));
    $wbs->addNode(new Node('Node C'));

    //get document as plantuml string
    echo $wbs->getDocumentContent();


#test-2.php


//create document
$wbs = new WorkBreakdownStructure('RootNode');

//add subitems
$nodes[] = new Node('Node A');
$nodes[] = new Node('Node B');
$nodes[] = new Node('Node C');

$nodes[1]
    ->addChild(new Node('Sub B.1'))
    ->addChild(
        (new Node('Sub B.B'))
            ->setToLeftPosition()
            ->setInlineColor('green')
    )
    ->setInlineColor('lightgray')
;

$wbs
    ->addChildrenNodes($nodes)
    ->getRootNode()
        ->setInlineColor('pink');

echo $wbs->getDocumentContent();


shell
php test-1.php > test-1.plantuml
shell
php test-2.php > test-2.plantuml