PHPackages                             felippe-regazio/php-hot-reloader - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. felippe-regazio/php-hot-reloader

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

felippe-regazio/php-hot-reloader
================================

A class to add a complete live reload feature to any php project

1.x-dev(6y ago)1063.4k↓100%30[3 issues](https://github.com/felippe-regazio/php-hot-reloader/issues)[1 PRs](https://github.com/felippe-regazio/php-hot-reloader/pulls)MITPHP

Since Dec 17Pushed 4y ago6 watchersCompare

[ Source](https://github.com/felippe-regazio/php-hot-reloader)[ Packagist](https://packagist.org/packages/felippe-regazio/php-hot-reloader)[ RSS](/packages/felippe-regazio-php-hot-reloader/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

PHP Hot Reloader
================

[](#php-hot-reloader)

\[UNMAINTAINED\]: This repository is currently unmaintained, I've been very busy in the last months and im struggling to find some time to take care of this repo but with no success. I'm sorry for those who are using it. If you want to maintain this repo, please open an issue and let me know.

This is a class that adds a live reload feature to any php project. It allows you to see your page dynamically changing while coding, without have to keep refreshing the browser on every change.

This Reloader uses a SSE (server-sent events) to listen to changes and notify the browser. So, no built-in server, no custom port, no pain configuration needed.

Installing
==========

[](#installing)

### Using Composer

[](#using-composer)

```
composer require felippe-regazio/php-hot-reloader:dev-master --prefer-source

```

### Manually

[](#manually)

Clone this repository and copy its folder to somewhere on your project.

Configuring
===========

[](#configuring)

1. Copy the `phrwatcher.php` file on the repository root to somewhere on your app. This file must be available through some URL (you can change its name if you prefer), and if you visit this file you must see the message "SSE\_ADDRESS\_OK | PROJECT ROOT:" informing your project root. Copy this URL, you'll gonna need it.
2. Open this file and configure the $variables according to your needings. Please, read the doc strings on the vars to properly configure them. Basically you will inform your app root on $PROJECT\_ROOT, files to watch and files to ignore relative to the app root on $WATCH and $IGNORE.
3. Now, lets imagine that you have configured your `phrwatcher.php` and it is available on the URL  (the URL that you copied on the first step). Now, you must activate the reloader by calling it on your application and pointing it to this URL like this:

```
require_once "/php-hot-reloader/src/HotReloader.php";
new HotReloader\HotReloader('//localhost/your-project/phrwatcher.php');
```

If you installed this repository using composer, you dont need the require\_once, just add the "autoloader" on your app and call the reloader.

So, you must pass the address that points to your `phrwatcher.php` file as the HotReloader() function param. You dont need to add the protocol, just add "//" as URL prefix. Is highly recommended to start the HotReloader on some front controller on your app. Also you should deactivate the reloader on production, never keep this feature active on production.

Git Integration
===============

[](#git-integration)

The $WATCH variable on the `phrwatcher.php` file defines the files and folders to track. So, instead of set a list of files and folder and observe them, you can Observe your repository. The Hot Reloader will use git to track the files currently being changed and watch them. This saves a lot of time and processing, since the files being tracked are updated automatically, and reserved only to the files that you are working on the moment. To track using GIT you must set your $WATCH variable like this:

```
$WATCH = "git:your/absolute/repository/path/";
```

If your `phrfile.php` is in your project root, you can use an automatic and dynamic version:

```
$WATCH = "git:" . __DIR__;
```

Now the Hot Reloader will automatically observe the files using your Git Status.

Tips
====

[](#tips)

When working with larger projects, the diff algorithm can take some time to calc the modified files. To avoid the "input lag", you can follow this tips:

1. On the `$WATCH` array of your phrwatcher.php try to keep only the necessary. If your project is huge, avoid using ".", and especify path by path, avoiding unecessary huge folders as vendors, tmp, log. Or consider use the Git Integration.
2. The `$IGNORE` array is related only to what you are watching. If any `vendor` folder on the paths that you are watching, you must add them to your ignore list. Paths such as vendor, node\_modules, sass\_cache, tmp, log, keep them ignored.
3. If your project is really big, is recomended to add the 'git' mode to your $WATCH list. So, your list will be always the result of a git status, consequently, you will be watching always the files that you are currently working on.

Example
=======

[](#example)

There is an example file on the root of this repository. The `example.php`. Open this file on your browser to see the Hot Reloader working.

###  Health Score

32

—

LowBetter than 74% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity38

Limited adoption so far

Community20

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 80% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2289d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d6726ef5d0e0275999cdba10ad60ca2d9fcaa585cb82cc53db76777b2e329a3b?d=identicon)[felippe-regazio](/maintainers/felippe-regazio)

---

Top Contributors

[![felippe-regazio](https://avatars.githubusercontent.com/u/31618881?v=4)](https://github.com/felippe-regazio "felippe-regazio (40 commits)")[![ttodua](https://avatars.githubusercontent.com/u/7117978?v=4)](https://github.com/ttodua "ttodua (5 commits)")[![omarlopesino](https://avatars.githubusercontent.com/u/3202817?v=4)](https://github.com/omarlopesino "omarlopesino (3 commits)")[![dharnarh](https://avatars.githubusercontent.com/u/24873093?v=4)](https://github.com/dharnarh "dharnarh (1 commits)")[![gagansandhu25](https://avatars.githubusercontent.com/u/8536502?v=4)](https://github.com/gagansandhu25 "gagansandhu25 (1 commits)")

### Embed Badge

![Health badge](/badges/felippe-regazio-php-hot-reloader/health.svg)

```
[![Health](https://phpackages.com/badges/felippe-regazio-php-hot-reloader/health.svg)](https://phpackages.com/packages/felippe-regazio-php-hot-reloader)
```

###  Alternatives

[somesh/php-query

A composer wrapper for the phpQuery package

1213.8k](/packages/somesh-php-query)[flowpack/nodegenerator

Random nodes generator for Neos CMS

122.1k](/packages/flowpack-nodegenerator)[haariga/craft-gonzo

Component Library from your templates Folder

121.7k](/packages/haariga-craft-gonzo)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
