PHPackages                             plakhin/laravel-artisan-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. plakhin/laravel-artisan-watcher

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

plakhin/laravel-artisan-watcher
===============================

A Laravel Artisan package to watch for file changes and automatically execute commands

03PHPCI passing

Since Mar 30Pushed 1mo ago1 watchersCompare

[ Source](https://github.com/plakhin/laravel-artisan-watcher)[ Packagist](https://packagist.org/packages/plakhin/laravel-artisan-watcher)[ RSS](/packages/plakhin-laravel-artisan-watcher/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (2)Used By (0)

[![Tests](https://github.com/plakhin/laravel-artisan-watcher/actions/workflows/tests.yml/badge.svg)](https://github.com/plakhin/laravel-artisan-watcher/actions/workflows/tests.yml)

Laravel Artisan Watcher
=======================

[](#laravel-artisan-watcher)

A Laravel package that provides file watching functionality to automatically execute a CLI or Artisan command when files change. This is useful for automatically running tests, linting, or any other command when your files are modified during development.

Warning

*Very early alpha — pure proof of concept.*
Believe it or not, **~95% of this package’s code is AI-generated** under 10 minutes with a single prompt!
For the full story, check out [the PR](https://github.com/plakhin/laravel-artisan-watcher/pull/1).

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

[](#installation)

You can install the package via composer:

```
composer require plakhin/laravel-artisan-watcher --dev
```

Usage
-----

[](#usage)

The package adds an `artisan watch` command that you can use to watch for file changes and trigger commands:

```
# Watch current directory and run tests when PHP files change
php artisan watch --command="php artisan test"

# Watch a specific directory for changes to JS files
php artisan watch app/Http --extensions=js --command="npm run lint"

# Watch with custom polling interval (in seconds)
php artisan watch --interval=2 --command="php artisan test"

# Exclude multiple directories
php artisan watch --exclude=vendor,node_modules,storage --command="php artisan test"
```

### Available Options

[](#available-options)

- `path`: The directory to watch (default: current directory)
- `--command`: The command to run when files change (required)
- `--interval`: Polling interval in seconds (default: 1)
- `--extensions`: Comma-separated list of file extensions to watch (default: php)
- `--exclude`: Comma-separated list of directories to exclude (default: vendor,node\_modules)

Example Use Cases
-----------------

[](#example-use-cases)

- Automatically run tests when files change:

    ```
    php artisan watch --command="php artisan test"
    ```
- Automatically compile assets when JavaScript or SCSS files change:

    ```
    php artisan watch resources --extensions=js,scss --command="npm run dev"
    ```
- Run type checking when PHP files change:

    ```
    php artisan watch --command="php artisan test:types"
    ```

Contributing
------------

[](#contributing)

Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests.

### Process

[](#process)

1. Fork the project
2. Create a new branch
3. Code, test, commit and push
4. Open a pull request detailing your changes.

### Guidelines

[](#guidelines)

- Please ensure the coding style running `composer lint`.
- Please keep the codebase modernized using automated refactors with Rector `composer refactor`.
- Send a coherent commit history, making sure each individual commit in your pull request is meaningful.
- You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts.
- Please remember to follow [SemVer](http://semver.org/).

### Linting

[](#linting)

```
composer lint
```

### Refactoring with Rector

[](#refactoring-with-rector)

```
composer refactor
```

### Testing

[](#testing)

Run all tests:

```
composer test
```

Check code style:

```
composer test:lint
```

Check possible code improvements:

```
composer test:refactor
```

Check types:

```
composer test:types
```

Run Unit tests:

```
composer test:unit
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Credits
-------

[](#credits)

- [Stanislav Plakhin](https://github.com/plakhin)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

21

—

LowBetter than 19% of packages

Maintenance60

Regular maintenance activity

Popularity3

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity13

Early-stage or recently created project

 Bus Factor1

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

### Community

Maintainers

![](https://www.gravatar.com/avatar/38485ee20c25dd9ef5283bc202a33042d439b8fc33256fa71eca75b8180b6f18?d=identicon)[plakhin](/maintainers/plakhin)

---

Top Contributors

[![plakhin](https://avatars.githubusercontent.com/u/25561058?v=4)](https://github.com/plakhin "plakhin (17 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (7 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (2 commits)")

### Embed Badge

![Health badge](/badges/plakhin-laravel-artisan-watcher/health.svg)

```
[![Health](https://phpackages.com/badges/plakhin-laravel-artisan-watcher/health.svg)](https://phpackages.com/packages/plakhin-laravel-artisan-watcher)
```

###  Alternatives

[wp-cli/wp-cli

WP-CLI framework

5.0k17.2M320](/packages/wp-cli-wp-cli)[consolidation/annotated-command

Initialize Symfony Console commands from annotated command class methods.

22569.8M19](/packages/consolidation-annotated-command)[chi-teck/drupal-code-generator

Drupal code generator

26947.8M5](/packages/chi-teck-drupal-code-generator)[seld/cli-prompt

Allows you to prompt for user input on the command line, and optionally hide the characters they type

24725.8M17](/packages/seld-cli-prompt)[illuminate/console

The Illuminate Console package.

12944.1M5.1k](/packages/illuminate-console)[php-tui/php-tui

Comprehensive TUI library heavily influenced by Ratatui

589747.0k6](/packages/php-tui-php-tui)

PHPackages © 2026

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