# [RFC] Request lifecycle hooks for SAPIs with a worker mode

- Thread: https://externals.io/message/133044
- Original archive: https://news-web.php.net/php.internals/133044
- Started by kevin@dunglas.fr on 2026-11-09T14:24:41+00:00
- Messages: 1
- RFC: Request lifecycle hooks for SAPIs with a worker mode (Under discussion) — https://externals.io/rfc/request_lifecycle_hooks.md
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · RFCs at https://externals.io/rfc.md · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #133044 — kevin@dunglas.fr — 2026-11-09T14:24:41+00:00

URL: https://externals.io/message/133044#133044

Hi internals,

Following the recent pre-RFC discussion
(https://news-web.php.net/php.internals/132960), I would like to open
the discussion on the "Request lifecycle hooks for SAPIs with a worker
mode" RFC:
https://wiki.php.net/rfc/request_lifecycle_hooks

As presented, this RFC proposes two optional module hooks, available
for extensions (no userland change), which are called between requests
served by a "worker" script.

I crafted a patch adding the hooks and support PHP functions. It
implements the hooks in the built-in standard, session and filter
extensions: https://github.com/dunglas/php-src/tree/request-boundary-hooks

Here is also a patch showing how to use this new engine feature in
FrankenPHP: https://github.com/php/frankenphp/compare/main...experiment/php-request-boundary-hooks

Best,
-- 
Kévin Dunglas

https://dunglas.dev
