Possibility to run defer tasks after response
@andrey-smaelov is already working on this.
Since Nov 1, 2024.
Assessment
This issue has not been assessed yet.
Description
Implement the ability to register and execute callbacks that run after the HTTP response is sent to the client, without blocking the request lifecycle.
This allows long-running or non-essential tasks (e.g. logging, sending emails, dispatching events) to be deferred, improving response time and user experience.
Acceptance Criteria:
-
Introduce a new internal hook named after_response (or similar).
-
Allow developers to register callbacks using HookManager::on('after_response', callable).
-
Ensure multiple parts of the codebase can register deferred tasks safely.
-
Execute all deferred callbacks after $response->send() in the lifecycle.
-
Wrap execution in try/catch to prevent deferred task failures from affecting app behavior.
-
Add config entry for after_response hook (optional, or register programmatically).
- Dominant language
- PHP
- Stars
- 36
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from quantum-php/framework
-
routing testing
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
quantum-php/framework#547 ·
-
view
Difficulty 1/5 Under an hour Newbie friendliness 75/100
quantum-php/framework#542 ·
-
enhancement http
Difficulty 5/5 Over a week Newbie friendliness 35/100
quantum-php/framework#565 · 1 comment ·
-
components view
Difficulty 5/5 Over a week Newbie friendliness 42/100
quantum-php/framework#551 ·
-
Add explicit @version special route token support for API major versioning within a single module Openrouting
Difficulty 5/5 Over a week Newbie friendliness 45/100
quantum-php/framework#550 ·
All issues in quantum-php/framework
Similar issues
-
jira-created
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 70/100
nunomaduro/phpinsights#745 ·
-
status/awaiting_triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Difficulty 1/5 Under an hour Newbie friendliness 90/100
WordPress/plugin-check#1486 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
az-digital/az_quickstart#6019 ·