@@ -65,6 +65,55 @@ composer require --dev maantje/xhprof-buggregator-laravel
65
65
> ** Note:**
66
66
> Read more about package usage in the [ package documentation] ( https://github.com/maantje/xhprof-buggregator-laravel ) .
67
67
68
+ ## Vanilla PHP
69
+
70
+ If you are using Vanilla PHP you just need to install
71
+ the [ spiral-packages/profiler] ( https://github.com/spiral-packages/profiler ) package.
72
+
73
+ ``` bash
74
+ composer require --dev spiral-packages/profiler
75
+ ```
76
+
77
+ And then configure a ` WebStorage ` client from the package to send data to Buggregator.
78
+
79
+ Here is an example:
80
+
81
+ ``` php
82
+ use SpiralPackages\Profiler\Profiler;
83
+ use SpiralPackages\Profiler\Driver\DriverInterface;
84
+ use SpiralPackages\Profiler\DriverFactory;
85
+ use SpiralPackages\Profiler\Storage\StorageInterface;
86
+ use SpiralPackages\Profiler\Storage\WebStorage;
87
+ use Symfony\Component\HttpClient\NativeHttpClient;
88
+
89
+ $storage = new WebStorage(
90
+ new NativeHttpClient(),
91
+ 'http://127.0.0.1/api/profiler/store',
92
+ );
93
+
94
+ $driver = DriverFactory::detect();
95
+
96
+ $profiler = new Profiler(
97
+ storage: $storage,
98
+ driver: $driver,
99
+ appName: 'My super app',
100
+ tags: [
101
+ // global tags
102
+ 'env' => 'local',
103
+ ]
104
+ );
105
+
106
+ $profiler->start(ignoredFunctions: []);
107
+
108
+ // Here is your code you want to profile
109
+
110
+ $profiler->end(tags: [
111
+ // Tags for specific requests
112
+ ]);
113
+ ```
114
+
115
+ Where ` http://127.0.0.1/api/profiler/store ` is the endpoint to send data to Buggregator.
116
+
68
117
## Configuration
69
118
70
119
After installing the package, you need to configure it. The package provides predefined environment variables to
0 commit comments