Skip to content

docs: improve worker docs, and add internals docs#2334

Open
dunglas wants to merge 4 commits intomainfrom
docs/improve
Open

docs: improve worker docs, and add internals docs#2334
dunglas wants to merge 4 commits intomainfrom
docs/improve

Conversation

@dunglas
Copy link
Copy Markdown
Member

@dunglas dunglas commented Apr 8, 2026

No description provided.

Copilot AI review requested due to automatic review settings April 8, 2026 15:12
@dunglas dunglas changed the title docs: improver worker docs, and add internals docs docs: improve worker docs, and add internals docs Apr 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the FrankenPHP worker documentation to better describe what state does (and doesn’t) get reset between requests in worker mode, helping users avoid cross-request data leakage and unexpected behavior.

Changes:

  • Documented that most PHP superglobals are reset between requests, while $_ENV is not.
  • Added a “State Persistence” section explaining which PHP state persists across requests, with an example.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

dunglas added 2 commits April 9, 2026 10:17
Updated notes regarding the `GEN_STUB_SCRIPT` environment variable and clarified that the source file is never modified. Added emphasis on naming conventions for PHP constants.

Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
Signed-off-by: Kévin Dunglas <kevin@dunglas.fr>
Copy link
Copy Markdown
Member

@alexandre-daubois alexandre-daubois left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works for me once Superlinter is happy 🙂

```

When writing worker scripts, make sure to reset any request-specific state at the beginning of each request handler.
Frameworks like [Symfony](symfony.md) and [Laravel Octane](laravel.md) handle this automatically.
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isnt it necessary to implement the symfony/contracts ResetInterface so that the framework automatically reset such object state inside worker apps ?

imho, this sentence should describe this, as reading "automatically" can be understood as nothing to do when using such framework

wdyt?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I think it's also at the end of each request after sending the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants