Named DB listeners: support DB::startListen($key, $callback) and DB::stopListen($key) #56233
Unanswered
JavierDavalos1988
asked this question in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Feature Request: Named DB listeners
Problem
Laravel currently allows registering database query listeners via
DB::listen($callback)
. However, it does not offer a way to remove listeners after they've been added, nor does it support scoping them to specific contexts such as jobs, tests, or timed segments.This makes it hard to build metrics systems, profilers, or conditional logging tools that need to attach/detach listeners dynamically.
Proposed Solution
Introduce the ability to add named query listeners, and later remove them by name:
Beta Was this translation helpful? Give feedback.
All reactions