Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Respect's avatar

how to listen globally to livewire updating hook from AppServiceProvider.php

how to listen globally to livewire updating hook from AppServiceProvider.php in boot method

  • Does not work
        \Livewire\Livewire::listen('component.updating', function ($component) {
            // This will now catch the internal "Livewire\Generated\Component..." classes
            throw new \Exception('Global Boot Caught SFC: ' );
        });
1 like
4 replies
imrandevbd's avatar

Assuming you're on v3, Livewire::listen is for events, not lifecycle hooks. You need to use Livewire::hook.

For global property updates, you should hook into commit:

use Livewire\Livewire;

public function boot(): void
{
    Livewire::hook('commit', function ($component, $commit) {
        // You can inspect $commit->updates for specific property changes.
    });
}

If you specifically need to run logic before the component finishes its cycle, commit is the standard way to intercept that in v3.

1 like
vincent15000's avatar

It seems to have been possible with version 2, I don't have tested if it's still available with version 3, but sure in versions 3 and 4, it doesn't appear in the documentation.

Please or to participate in this conversation.