PHPackages                             littlesqx/php-watcher - 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. [CLI &amp; Console](/categories/cli)
4. /
5. littlesqx/php-watcher

ActiveLibrary[CLI &amp; Console](/categories/cli)

littlesqx/php-watcher
=====================

Automatically restart PHP application once the source code changes

v0.3.2(6y ago)04MITPHPPHP ^7.1

Since Oct 4Pushed 6y agoCompare

[ Source](https://github.com/Littlesqx/php-watcher)[ Packagist](https://packagist.org/packages/littlesqx/php-watcher)[ RSS](/packages/littlesqx-php-watcher/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (3)Dependencies (6)Versions (5)Used By (0)

PHP-watcher
===========

[](#php-watcher)

[![Build Status](https://camo.githubusercontent.com/94e3843116d8ae8b9493c816b9b193772d9b33fa5bb1f975f2f0c3ba2eb62c3f/68747470733a2f2f7472617669732d63692e6f72672f6c6974746c657371782f7068702d776174636865722e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/littlesqx/php-watcher)

PHP-watcher helps develop long-running PHP applications by automatically restarting them when file changes in the directory are detected.

Here's how it looks like:

[![watcher screenshot](watcher.jpg)](watcher.jpg)

PHP-watcher does not require any additional changes to your code or method of development. `php-watcher` is a replacement wrapper for `php`, to use PHP -watcher replace the word `php` in the command line when executing your script.

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

[](#installation)

You can install this package globally like this:

```
composer global require littlesqx/php-watcher
```

After that phpunit-watcher watch can be run in any directory on your system.

Alternatively, you can install the package locally as a dev dependency in your project:

```
composer require littlesqx/php-watcher --dev
```

Locally installed you can run it with `vendor/bin/php-watcher`.

Usage
-----

[](#usage)

All the examples assume you've installed the package globally. If you opted for the local installation prepend `vendor/bin/` everywhere where `php-watcher` is mentioned.

PHP-watcher wraps your application, so you can pass all the arguments you would normally pass to your app:

```
php-watcher [your php app]
```

Using PHP-Watcher is simple. If your application accepts a host and port as the arguments, I can start it using option `--arguments`:

```
php-watcher server.php --arguments localhost --arguments 8080
```

Any output from this script is prefixed with `[php-watcher]`, otherwise all output from your application, errors included, will be echoed out as expected.

Config files
------------

[](#config-files)

PHP-Watcher supports customization of its behavior with config files. The file for options may be named `.php-watcher.yml`, `php-watcher.yml` or `php -watcher.yml.dist`. The tool will look for a file in the current working directory in that order. An alternative local configuration file can be specified with the `--config ` option.

The specificity is as follows, so that a command line argument will always override the config file settings:

- command line arguments
- local config

A config file can take any of the command line arguments, for example:

```
watch:
  - src
  - config
extensions:
  - php
  - yml
ignore:
  - tests
```

Monitoring multiple directories
-------------------------------

[](#monitoring-multiple-directories)

By default, PHP-Watcher monitors the current working directory. If you want to take control of that option, use the `--watch` option to add specific paths:

```
php-watcher --watch src --watch config server.php
```

Now PHP-Watcher will only restart if there are changes in the `./src` or `./config ` directories. By default traverses sub-directories, so there's no need to explicitly include them.

Specifying extension watch list
-------------------------------

[](#specifying-extension-watch-list)

By default, PHP-Watcher looks for files with the `.php` extension. If you use the `--ext` option and monitor `app,yml` PHP-Watcher will monitor files with the extension of `.php` and `.yml`:

```
php-watcher server.php --ext=php,js
```

Now PHP-Watcher will restart on any changes to files in the directory (or subdirectories) with the extensions `.php`, `.yml`.

Ignoring files
--------------

[](#ignoring-files)

By default, PHP-Watcher will only restart when a `.php` file changes. In some cases you may want to ignore some specific files, directories or file patterns, to prevent PHP-Watcher from prematurely restarting your application.

This can be done via the command line:

```
php-watcher server.php --ignore public/ --ignore tests/
```

Or specific files can be ignored:

```
php-watcher server.php --ignore src/config.php
```

Patterns can also be ignored (but be sure to quote the arguments):

```
php-watcher server.php --ignore 'src/config/*.php'
```

Note that by default, PHP-Watcher ignores all *dot* and VCS files.

Delaying restarting
-------------------

[](#delaying-restarting)

In some situations, you may want to wait until a number of files have changed . The timeout before checking for new file changes is 1 second. If you're uploading a number of files and it's taking some number of seconds, this could cause your app to restart multiple times unnecessarily.

To add an extra throttle, or delay restarting, use the `--delay` option:

```
php-watcher server.php --delay 10
```

For more precision, use a float:

```
php-watcher server.php --delay 2.5
```

Default executable
------------------

[](#default-executable)

By default, PHP-Watcher uses `php` bin executable to run your scripts. If you want to provide your own executable use `--exec` option or `executable ` param in config file. This is particularly useful if you're working with several PHP versions.

```
executable: php
```

or using CLI:

```
php-watcher server.php --exec php7
```

License
=======

[](#license)

MIT

How can I thank you?
--------------------

[](#how-can-i-thank-you)

Why not star this GitHub repo? I'd love the attention! Or, you can donate to my project on PayPal:

[![Support me with some coffee](https://camo.githubusercontent.com/211dae6c917cff3e611371d9fb804fc9927acec076ae57aef46edd0b6f32d1aa/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f646f6e6174652d70617970616c2d6f72616e67652e737667)](https://www.paypal.me/seregazhuk) (Original Author: @seregazhuk)

Thanks!

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity46

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.9% 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 ~4 days

Total

4

Last Release

2397d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/16516151?v=4)[Littlesqx](/maintainers/Littlesqx)[@Littlesqx](https://github.com/Littlesqx)

---

Top Contributors

[![seregazhuk](https://avatars.githubusercontent.com/u/9959761?v=4)](https://github.com/seregazhuk "seregazhuk (22 commits)")[![Littlesqx](https://avatars.githubusercontent.com/u/16516151?v=4)](https://github.com/Littlesqx "Littlesqx (7 commits)")

---

Tags

hot-reloadphp-watcherswoole

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/littlesqx-php-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/littlesqx-php-watcher/health.svg)](https://phpackages.com/packages/littlesqx-php-watcher)
```

###  Alternatives

[crunzphp/crunz

Schedule your tasks right from the code.

2292.0M6](/packages/crunzphp-crunz)[crazywhalecc/static-php-cli

Build single static PHP binary, with PHP project together, with popular extensions included.

1.8k13.9k](/packages/crazywhalecc-static-php-cli)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[madewithlove/license-checker

CLI tool to verify allowed licenses for composer dependencies

54449.8k21](/packages/madewithlove-license-checker)[phpcr/phpcr-shell

Shell for PHPCR

721.3M8](/packages/phpcr-phpcr-shell)[statamic/cli

Statamic CLI Tool

7587.7k](/packages/statamic-cli)

PHPackages © 2026

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