So if removing the spatie package doesn't make this work, the problem is not in the package right?
Can you show some of the output and your view template? Maybe we can spot a difference?
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I added Spatie's Google Tag Manager to my application (https://github.com/spatie/laravel-googletagmanager)
Ever since adding it, my Toastr notifications have stopped working, and I have no idea why. The Toastr package I'm using is this one (https://packagist.org/packages/oriceon/toastr-5-laravel)
There are 3 items that get included in your template (the .css, the .js, and then a little render() function call).
The .css and .js are loading just fine; however, the {!! Toastr::render() !!}} function is not getting called on the page. When I use chrome dev tools to look at the elements of the page, it should print out the Toastr options, but it's not including them.
Any thoughts? I've tried removing the spatie package, but it still has not resolved the conflict.
I've also run composer dump-autoload, all variables of php artisan clear, and even manually deleted the cache files in bootstrap/cache. None have seemed to have any effect.
I should also mention that there are no errors in the log. So I can't track down why it isn't loading. I've also checked storage/logs to see if there's any detail in there, and I can't find anything related to toastr there either.
So through a series of troubleshooting with the "fresh test app", I've determined the exact point in the Spatie installation process that breaks the Toastr notifications. When you add this to the Kernel.php:
// app/Http/Kernel.php
protected $middleware = [
...
\Illuminate\Session\Middleware\StartSession::class,
\Spatie\GoogleTagManager\GoogleTagManagerMiddleware::class,
...
];
That's what breaks the Toastr notifications. Not the vendor publish. In my fresh test app, I can comment these lines out, and everything works great.
Specifically the culprit is the StartSession middleware. If I comment out the TagManager line, but leave the StartSession line in there, Toastr is broken; however, if I comment out the Startsession and leave the TagManager running, Toastr works.
So I'm not sure I care to troubleshoot any further, but I'll leave this discussion here for anyone else in the future who gets baffled by this.
The final summary to all of this is to not use the: "\Illuminate\Session\Middleware\StartSession::class," middleware in Spatie Google Tag Manager if you are currently using Oriceon's Toastr notifications package.
Please or to participate in this conversation.