PHPackages                             thesis/hot-reload - 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. thesis/hot-reload

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

thesis/hot-reload
=================

Thesis Hot Reload

0.4.0(2mo ago)330↓90.9%MITPHPPHP ^8.4CI passing

Since Mar 27Pushed 2mo agoCompare

[ Source](https://github.com/thesis-php/hot-reload)[ Packagist](https://packagist.org/packages/thesis/hot-reload)[ Fund](https://www.tinkoff.ru/cf/5MqZQas2dk7)[ RSS](/packages/thesis-hot-reload/feed)WikiDiscussions 0.4.x Synced 3w ago

READMEChangelog (7)Dependencies (17)Versions (11)Used By (0)

Thesis Hot Reload
=================

[](#thesis-hot-reload)

Watches files for changes and automatically restarts a command.

Useful for development servers, workers, or any long-running PHP tasks.

Supports debouncing to avoid redundant restarts when multiple files change at once.

Installation
------------

[](#installation)

```
composer require thesis/hot-reload --dev
```

Requires PHP 8.4+.

Usage
-----

[](#usage)

```
vendor/bin/hot-reload [options] [--]
```

### Options

[](#options)

OptionDescriptionDefault`--path`Paths to watch (repeatable)`src``--ext`File extensions to watch (repeatable; if none, all are watched)none`--exclude`Patterns to exclude (repeatable, e.g. `*.generated.php`)none`--debounce`Delay in seconds before restarting after a change`0.1``--term-timeout`Seconds to wait for the process to exit after `SIGTERM` before sending `SIGKILL``3``--forward-signal`Signals to forward to the process (repeatable, e.g. `SIGUSR1` or `10`)none### Exit code

[](#exit-code)

`vendor/bin/hot-reload` returns the exit code of the watched command if it terminated on its own, or `0` when stopped via `SIGINT` or `SIGTERM`.

### Examples

[](#examples)

```
# Watch src/, restart on any file change
vendor/bin/hot-reload -- php server.php

# Watch multiple paths, only .php files
vendor/bin/hot-reload --path=src --path=config --ext=php -- php server.php

# Exclude generated files
vendor/bin/hot-reload --path=src --ext=php --exclude='*.generated.php' -- php server.php

# Increase debounce delay (useful when many files change at once)
vendor/bin/hot-reload --debounce=0.5 -- php server.php
```

PHP API
-------

[](#php-api)

You can use `hotReload()` directly in PHP instead of the bin script:

```
use Amp\Cancellation;
use Amp\Http\Server\SocketHttpServer;
use function Amp\ByteStream\getStdout;
use function Amp\trapSignal;
use function Thesis\hotReload;

hotReload(
    files: __DIR__,
    task: static function (Cancellation $termination): void {
        $server = SocketHttpServer::createForDirectAccess(/** ... */);

        $termination->subscribe($server->stop(...));

        $server->expose(/** ... */);

        $server->start(/** ... */);

        trapSignal([SIGINT, SIGTERM], cancellation: $termination);

        $server->stop();
    },
    onReload: static function (): void {
        getStdout()->write("\nFiles changed, reloading server...\n\n");
    },
);
```

`$termination` is cancelled when files change or when `hotReload()` itself is cancelled — subscribe to it to stop the task gracefully.

### TransparentProcess

[](#transparentprocess)

Use [`TransparentProcess::start()`](src/HotReload/TransparentProcess.php) to run an external command with full TTY transparency:

- stdin/stdout/stderr are inherited
- specified signals are forwarded
- the process is terminated gracefully via `SIGTERM`
- `SIGKILL` is dispatched after a timeout.

See [`bin/hot-reload`](bin/hot-reload) for a real-world usage example.

Roadmap
-------

[](#roadmap)

- [inotify](https://www.php.net/manual/en/book.inotify.php)-based change detector for Linux (event-driven, no polling)

License
-------

[](#license)

MIT

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance83

Actively maintained with recent releases

Popularity12

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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

Every ~0 days

Total

11

Last Release

87d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/2552865?v=4)[Valentin Udaltsov](/maintainers/vudaltsov)[@vudaltsov](https://github.com/vudaltsov)

---

Top Contributors

[![vudaltsov](https://avatars.githubusercontent.com/u/2552865?v=4)](https://github.com/vudaltsov "vudaltsov (27 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/thesis-hot-reload/health.svg)

```
[![Health](https://phpackages.com/badges/thesis-hot-reload/health.svg)](https://phpackages.com/packages/thesis-hot-reload)
```

###  Alternatives

[danog/madelineproto

Async PHP client API for the telegram MTProto protocol.

3.4k885.1k22](/packages/danog-madelineproto)[amphp/process

A fiber-aware process manager based on Amp and Revolt.

25657.8M65](/packages/amphp-process)[drupal/core

Drupal is an open source content management platform powering millions of websites and applications.

19564.8M1.6k](/packages/drupal-core)[phel-lang/phel-lang

Phel is a functional programming language that compiles to PHP

5155.1k17](/packages/phel-lang-phel-lang)[friendsoftypo3/content-blocks

TYPO3 CMS Content Blocks - Content Types API | Define reusable components via YAML

101466.4k45](/packages/friendsoftypo3-content-blocks)

PHPackages © 2026

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