Skip to content

Commit dc027d5

Browse files
committed
Add Symfony Events documentation
1 parent 1098693 commit dc027d5

File tree

1 file changed

+21
-11
lines changed

1 file changed

+21
-11
lines changed

docs/integrations/symfony.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ return new ConsoleApplication(static function (array $context) {
9494
});
9595
```
9696

97-
\* Modifying the `bin/console` file is essential to integrate console commands with PHPStreamServer—do not skip this step.
97+
⚠️ Modifying the `bin/console` file is essential to integrate console commands with PHPStreamServer—do not skip this step.
9898

9999
### Start the server
100100
```bash
@@ -111,16 +111,11 @@ return static function (Server $server): void {
111111
};
112112
```
113113
The following arguments are supported:
114-
🔵 `Server $server`
115-
Server instance to register plugins and workers
116-
🔵 `array $context`
117-
This is the same as $_SERVER + $_ENV
118-
🔵 `string $projectDir`
119-
Project root directory
120-
🔵 `string $env`
121-
Current environment
122-
🔵`bool $debug`
123-
Is in debug mode
114+
- `Server $server` Server instance to register plugins and workers
115+
- `array $context` This is the same as $_SERVER + $_ENV
116+
- `string $projectDir` Project root directory
117+
- `string $env` Current environment
118+
- `bool $debug` Is in debug mode
124119

125120
## Intergation with Monolog
126121
If you use Monolog as your main logging system in Symfony, you can route all logs to the PHPStreamServer logger. This bundle provides a special Monolog handler for seamless integration, which can be configured in the `monolog.yaml` file.
@@ -161,3 +156,18 @@ when@prod:
161156
channels: ["!event", "!doctrine"]
162157

163158
```
159+
160+
## Symfony Events
161+
During the workers' lifecycle, they [dispatch events](https://symfony.com/doc/current/event_dispatcher.html) which you can use to get to know what happens with workers.
162+
163+
#### ProcessStartEvent
164+
Event Class: [ProcessStartEvent](https://github.com/phpstreamserver/symfony/blob/main/src/Event/ProcessStartEvent.php)
165+
Triggered when a worker process starts.
166+
167+
#### ProcessStopEvent
168+
Event Class: [ProcessStopEvent](https://github.com/phpstreamserver/symfony/blob/main/src/Event/ProcessStopEvent.php)
169+
Triggered when a worker process stops.
170+
171+
#### ProcessReloadEvent
172+
Event Class: [ProcessReloadEvent](https://github.com/phpstreamserver/symfony/blob/main/src/Event/ProcessReloadEvent.php)
173+
Triggered when a worker process is reloaded.

0 commit comments

Comments
 (0)