Skip to content

Commit 8352667

Browse files
committed
Update the README accordingly.
1 parent 0ef60e9 commit 8352667

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

README.md

+13-12
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Blog post: [https://not-a-number.io/2018/phptree-a-fast-tree-implementation](htt
5252

5353
## Optional packages
5454

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

5858
## Usage
@@ -83,22 +83,23 @@ $tree->add(...$nodes);
8383

8484
// Export to text.
8585
$textExporter = new Text();
86-
echo $textExporter->export($tree); // [root[A[C[G[O][P]][H[Q][R]]][D[I[S][T]][J[U][V]]]][B[E[K[W][X]][L[Y][Z]]][F[M][N]]]]⏎
86+
$textExporter->export($tree); // [root[A[C[G[O][P]][H[Q][R]]][D[I[S][T]][J[U][V]]]][B[E[K[W][X]][L[Y][Z]]][F[M][N]]]]⏎
8787

88-
// Export to a GraphViz script.
89-
$exporter = new Gv();
90-
$dotScript = $exporter->export($tree);
91-
file_put_contents('graph.gv', $dotScript);
92-
// Then do "dot -Tsvg graph.gv -o graph.svg" to export the script to SVG.
88+
// Export to a GraphViz script with the Gv exporter
89+
$graphvizExporter = new Gv();
90+
$dotScript = $graphvizExporter->export($tree);
91+
file_put_contents('tree.dot', $dotScript);
92+
// Then do "dot -Tsvg tree.dot -o tree.svg" to export in SVG.
9393

94-
// Or use the image converter that does it for you.
95-
$exporter = new Image();
96-
$imagePath = $exporter->setFormat('png')->export($tree);
94+
// Or use the Image exporter that does it for you.
95+
$imageExporter = new Image();
96+
$imageContent = $imageExporter->setFormat('png')->export($tree);
97+
file_put_contents('tree.png', $imageContent);
9798

9899
// If you want to launch the image, you can use an optional package.
99-
// do: composer require loophp/launcher
100+
// do: composer require drupol/launcher
100101
// then:
101-
Launcher::open($imagePath);
102+
Launcher::open('tree.png');
102103
```
103104

104105
## Code quality, tests and benchmarks

0 commit comments

Comments
 (0)