Download the PHP package hotwired-laravel/hotreload without Composer

On this page you can find all versions of the php package hotwired-laravel/hotreload. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package hotreload

Hotreload for Turbo Laravel

Build Status Latest Stable Version License

It enhances development feedback loops by detecting source code changes and updating the page smoothly without requiring manual reloads.

This package is still under development.

Inspiration

This package was heavily inspired by the Hotwire Spark gem. The JavaScript that makes this all work in the browser was copied from there. The package was reimplemented in PHP to work with Laravel.

Installation

That's it!

By default, a simple file watcher will be used. There's another file watcher that is more efficient but requires the inotify extension, which you may install via PECL:

Don't forget to enable it in your php.ini. Since this package is for local development only, you'll only need that extension locally. Once you have the extension installed and enabled, the package should automatically pick the correct file watcher.

Optionally, you may force the use of a specific file watcher by calling this code in your AppServiceProvider@boot method (don't forget to wrap it for local env only):

Hot it works

The package injects a script into your application via a middleware. That script will start an EventSource subscribed to a Server-Sent Events (aka. SSE) that will start watching files for changes in the configured directory. There are a couple of reloaders which are activated depending on which directory you configured (or the default ones):

This package was built for Turbo Laravel, so it expects that you're using Importmaps Laravel and something like TailwindCSS Laravel. How it will work:

Configuration

On PHP Processes

For this to work, we need at least 2 processes, since the SSE route will cause the process to hang indefinitely. If you're using php artisan serve (which Laravel Sail uses by default). For that reason, make sure you set the number of PHP processes on your .env file:

Laravel does that by default nowadays. You must also provide the --no-reload option to the serve command:

HTML Replacing Method

By default, it will using morphing to replace HTML changes. You may want to use HTML replace instead of morphing on some pages that are more JS-heavy (like if you have a rich text editor like Trix on it, for instance). To do so, you may control this on a per-page basis using a meta tag somewhere on that page's view:

Enable Logging

If you want to, you may enable logging with a meta tag on the page (you may place this somewhere global like a layout file):

Monitoring Paths

By default, the package will watch for changes on a few default directories (you may configure extra ones):

Type Description
HTML Paths Paths where file changes should trigger an HTML reloading. By default: resources/views.
CSS Paths Paths where file changes should trigger a CSS reloading. By default: resources/css and public/dist/css (if exists).
Stimulus Paths Paths where file changes should trigger a Stimulus reloading. By default: resources/js/controllers (if exists).

You may configure additional paths by calling the respective method on the Hotreload class in your AppServiceProvider@boot method (don't forget to wrap it for local env only):


All versions of hotreload with dependencies

PHP Build Version
Package Version
Requires illuminate/support Version ^12.4
illuminate/http Version ^12.4
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package hotwired-laravel/hotreload contains the following files

Loading the files please wait ....