Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Live Reload Bundle Laravel Package

kunstmaan/live-reload-bundle

Symfony bundle that adds automatic live reload to development: it watches templates, assets and config, then refreshes the browser when files change, so updates appear instantly without manual reloads. Handy for Kunstmaan CMS projects.

View on GitHub
Deep Wiki
Context7

Getting Started

This is a Symfony bundle, not a Laravel package. There is no service provider, no config/live_reload.php, and nothing in it will autoload under Laravel. If you're evaluating it from a Laravel context, read this as "what the equivalent thing costs to build" — you can reproduce 100% of its behaviour with a five-line response listener or, more likely, just use Vite's HMR which Laravel ships with.

What it actually does is narrow: on kernel.response, if the response looks like HTML, it appends a <script src="//host:port/livereload.js"> tag before </body>. The script is the client half of grunt-contrib-watch's live reload (or any LiveReload-protocol server on port 35729). Nothing more.

Minimal steps:

  1. composer require --dev kunstmaan/live-reload-bundle — expect resolver pain. Last tagged release is 2014-08-13, so the constraints target Symfony 2.x and PHP 5.x. On a modern stack you'll need a fork, a path repository, or --ignore-platform-reqs plus luck. Verify the bundle class namespace from composer.json before wiring it up.
  2. Register it only in the dev environment:
    // app/AppKernel.php
    if (in_array($this->getEnvironment(), ['dev', 'test'], true)) {
        $bundles[] = new Kunstmaan\LiveReloadBundle\KunstmaanLiveReloadBundle();
    }
    
  3. Run a LiveReload server. With Grunt:
    watch: {
      options: { livereload: true },
      styles: { files: ['web/scss/**/*.scss'], tasks: ['sass'] }
    }
    
  4. Load a page in dev and watch the Network tab for livereload.js and the subsequent WebSocket upgrade.

Where to look first, since documentation is essentially nonexistent: DependencyInjection/Configuration.php (the real config keys and defaults), then the event listener under EventListener/ (confirms injection point, content-type check, and script URL shape). Read those two files before guessing at YAML.

First real use case: editing SCSS and having the browser swap the stylesheet without a reload — the same feedback loop Laravel Mix/Vite gives you via npm run dev, but driven by a Grunt daemon.

Implementation Patterns

Dev-only registration is the whole pattern. This bundle has no business being enabled in production, and it has no environment guard of its own — the guard is the AppKernel conditional. If you copy bundle registration into a shared config file, you will ship a script tag pointing at localhost:35729 to users.

Auto-injection with a manual fallback. The listener only reliably catches full HTML responses. When it misses (streamed responses, unusual content types, responses short-circuited by another listener with higher priority), put the tag in your base layout yourself:

{% if app.environment == 'dev' %}
    <script src="//{{ live_reload_host|default('localhost') }}:35729/livereload.js"></script>
{% endif %}

This is also the escape hatch when you want the tag in a specific position, or only on certain pages.

One reload server, not two. This bundle overlaps with Assetic's watch, Webpack Encore's dev server, and Browsersync. Pick one. Double-injection produces two WebSocket connections and double reloads, which looks like a bug in your asset pipeline and isn't.

Configuration belongs in config_dev.yml. Anything you set — host, port, enabled flag — should live in the dev config file so production config never mentions the bundle. Confirm exact key names against Configuration.php; don't trust blog posts, the bundle predates most of them.

In a Laravel context, the direct analogue is:

// webpack.mix.js
mix.browserSync('myapp.test');

or, on a current Laravel, Vite's HMR which is already wired into @vite and needs no bundle at all. If you genuinely need "inject into arbitrary HTML responses," a small middleware mirroring the listener is ~20 lines and you control the content-type check.

Gotchas and Tips

  • Abandoned since 2014. No commits in a decade, 22 stars, zero dependents. Treat it as a reference implementation to copy, not a dependency to install. The listener logic is short enough to reimplement against modern Symfony (EventSubscriberInterface, autowiring, kernel.response) in less time than you'll spend fighting Composer constraints.
  • Content-Length is not recalculated. Appending bytes to a response that already declared a length truncates the page behind strict servers, some proxies, and certain PHP-FPM setups. If pages cut off mid-script, this is why. Strip the header or recalculate after injection.
  • Compressed responses break injection. If another listener gzips the body before this one runs, string replacement either no-ops or corrupts output. Ordering matters; check listener priority.
  • HTTPS pages loading http://localhost:35729/livereload.js is mixed content and is silently blocked in every modern browser. Either serve on the same scheme or put the reload server behind your dev proxy on a path.
  • CSP blocks it. Any non-trivial Content-Security-Policy will reject the script and the WebSocket. Add localhost:35729 to script-src and connect-src in dev, or don't use this.
  • Silent failure mode: the script loads, the socket fails, nothing reloads, no error you'll notice. Open DevTools → Network → WS and confirm the upgrade actually happened before debugging your Grunt config.
  • Port collisions. Port 35729 already taken by another project's watcher means the injected script connects to that server and reloads the wrong tab — or nothing. Check with lsof -i :35729.
  • Debugging registration: bin/console debug:event-dispatcher kernel.response should list the listener. If it isn't there, the bundle isn't registered in this environment — that's a config problem, not a bundle problem. Use config:dump-reference to see real config keys instead of guessing.
  • Extension points are thin: a Twig extension (if present in your version) or replacing the listener with a higher-priority one of your own. There's no plugin system worth relying on.
  • The honest recommendation: for a Symfony app use Webpack Encore or the Vite bundle; for Laravel use Vite; for anything else drop browser-sync in front of the dev server. All three are maintained, handle HTTPS and CSP, and don't touch your response bodies.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
mrnewport/laravel-plaid
mrnewport/laravel-repo
mrnewport/laravel-docsign
mrnewport/laravel-stow
mrnewport/laravel-flow
mrnewport/laravel-priceable
mrnewport/laravel-nestedterms
fredmeng/laravel-apidoc-generator
itstructure/laravel-multilingual-tools
pdustdar/elasticsearch
markupai/php-sdk
rlacerda83/lumem-microservice-shipment
uni-method/symfony-lib
tacticmedia/scim-server-bundle
neika-ai/symfony-bundle
mattleads/agent-publishing-bundle
glavweb/framework-bundle
glavweb/extra-bundle
glavweb/api-bundle
glavweb/admin-bundle