Skip to content

Commit

Permalink
Update README file.
Browse files Browse the repository at this point in the history
  • Loading branch information
drupol committed Jul 2, 2019
1 parent aaa6af7 commit f5790eb
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt

## Optional packages

* [drupol/launcher](https://github.com/drupol/launcher): To automatically open a resource using the proper application on your operating system.
* [graphp/graphp](https://github.com/graphp/graph): To export a tree into a Graph.

## Usage
Expand All @@ -62,8 +63,10 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt
declare(strict_types = 1);

use drupol\phptree\Exporter\Gv;
use drupol\phptree\Exporter\GvConvert;
use drupol\phptree\Node\ValueNode;
use drupol\phptree\Exporter\Text;
use drupol\launcher\Launcher;

include './vendor/autoload.php';

Expand All @@ -87,6 +90,15 @@ $exporter = new Gv();
$dotScript = $exporter->export($tree);
file_put_contents('graph.gv', $dotScript);
// Then do "dot -Tsvg graph.gv -o graph.svg" to export the script to SVG.

// Or use GvConvert() that does it for you.
$exporter = new GvConvert();
$imagePath = $exporter->setFormat('png')->export($tree);

// If you want to launch the image, you can use an optional package.
// do: composer require drupol/launcher
// then:
Launcher::open($imagePath);
```

## Code quality, tests and benchmarks
Expand Down

0 comments on commit f5790eb

Please sign in to comment.