Skip to content

Commit

Permalink
[add] Added example usage in readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
kEERill committed Dec 23, 2024
1 parent af185c2 commit 41ab654
Showing 1 changed file with 41 additions and 1 deletion.
42 changes: 41 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,47 @@ Disabled values: `false` `0` `off` `no`

This feature works great with a browser extension like [ModHeader](https://modheader.com/). It lets you switch profiling on and off right from your browser.

## Usage with Sail
### Usage Profiler

By default, the profiler is turned on and off with each HTTP request.
However, you may have other points where your\application starts. For example, it can be queues, commands, and so on.

In such cases, you can configure the profiler to run in the desired location yourself:

```php

use SpiralPackages\Profiler\Profiler;

class RegisterUserActionJob
{
public function __construct(
public string $name,
public string $password
) {
}

/**
* Get Profiler object from Container DI
*
* @param Profiler $profiler
* @return void
*/
public function handle(Profiler $profiler): void
{
try {
$profiler->start();

// code for register new user
}
finally {
$profiler->end();
}
}
}

```

### Usage with Sail

Add the buggregator service to your docker-compose file:

Expand Down

0 comments on commit 41ab654

Please sign in to comment.