Last year the 37signals folks released Hotwire Spark, a gem that implements a simple hotreloading mechanism of Hotwired apps. This is specifically built for Hotwire and the #nobuild movement.
If you tried Turbo Laravel with Importmap Laravel, Tailwind CSS Laravel, and Stimulus Laravel, you probably felt the need for something like this too. I know I have. Laravel relies on Vite for hotreloading and that sure works nicely, but I wanted to see if this was feasible with PHP-only (#nobuild). Turns out it was!
There were many ways I could go about building it in PHP, but I didn't want it to require additional commands, new tooling, or anything like that. So, the package relies on Server-Sent Events (aka. SSE). It subscribes to an endpoint that will start the watchers for file changes. I started with a simplistic file-watching implementation that scans the directories and checks the modified time of files. But I also added another implementation that uses PHP's inotify extension, which should be better than manually scanning the directories.
The reloaders are the same ones from the Hotwire Spark gem, so we have one for reloading CSS, another for Stimulus Controllers, and two for reloading HTML: one that uses morphing, and another one that uses replacing - which you may configure via meta tags on specific pages when you need that: