@@ -37,9 +37,9 @@ Or manually update `require-dev` block of `composer.json` and run `composer upda
3737### Quick Start
3838
3939``` php
40- use DragonCode\Benchmark\Benchmark ;
40+ use function DragonCode\Benchmark\bench ;
4141
42- new Benchmark ()
42+ bench ()
4343 ->compare(
4444 static fn () => true,
4545 static fn () => true
@@ -49,6 +49,56 @@ new Benchmark()
4949
5050### How To Use
5151
52+ You can use both the ` bench() ` function and the ` Benchmark ` class.
53+
54+ ``` php
55+ use DragonCode\Benchmark\Benchmark;
56+
57+ use function DragonCode\Benchmark\bench;
58+
59+ bench()->compare([
60+ fn () => /* some code */,
61+ fn () => /* some code */,
62+ ])->toConsole();
63+
64+ new Benchmark()->compare([
65+ fn () => /* some code */,
66+ fn () => /* some code */,
67+ ])->toConsole();
68+ ```
69+
70+ #### As a function
71+
72+ ``` php
73+ use function DragonCode\Benchmark\bench;
74+
75+ // Array without named keys
76+ bench()->compare([
77+ fn () => /* some code */,
78+ fn () => /* some code */,
79+ ])->toConsole();
80+
81+ // Array with named keys
82+ bench()->compare([
83+ 'foo' => fn () => /* some code */,
84+ 'bar' => fn () => /* some code */,
85+ ])->toConsole();
86+
87+ // Callbacks without named parameters
88+ bench()->compare(
89+ fn () => /* some code */,
90+ fn () => /* some code */,
91+ )->toConsole();
92+
93+ // Callbacks with named parameters
94+ bench()->compare(
95+ foo: fn () => /* some code */,
96+ bar: fn () => /* some code */,
97+ )->toConsole();
98+ ```
99+
100+ #### As a class
101+
52102``` php
53103use DragonCode\Benchmark\Benchmark;
54104
0 commit comments