2017 © Pedro Peláez

library phpspec-watcher

phpspec-watcher is a cli tool for the automatic execution of phpspec tests when code changes



phpspec-watcher is a cli tool for the automatic execution of phpspec tests when code changes

  • Wednesday, May 23, 2018
  • by fetzi
  • Repository
  • 2 Watchers
  • 6 Stars
  • 1,845 Installations
  • PHP
  • 6 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 7 Versions
  • 15 % Grown


phpspec Watcher

Packagist Github Actions StyleCI SensioLabs Insight Maintainability, (*1)


phpspec-watcher is a tool for automating phpspec test execution when the source code of a project changes. On file save the watcher automatically triggers the phpspec test suite and informs the developer about the test results., (*2)


This tool can be installed globally with, (*3)

composer global require fetzi/phpspec-watcher

or just for one package as dev-dependency, (*4)

composer require fetzi/phpspec-watcher --dev


After a global installation you can invoke the watcher by calling, (*5)

phpspec-watcher watch

If you have installed the watcher as a dev-dependency for one project you can find the binary within the vendor bin directory., (*6)

vendor/bin/phpspec-watcher watch


The watcher can be configured with a configuration file .phpspec-watcher.yml stored in the project root directory., (*7)

The following listing shows the file structure and the option meanings:, (*8)

fileMask: '*.php'                   # file pattern that should be watched

checkInterval: 1                    # a float value indicating the resource check interval

directories:                        # a list of directories that should be watched
    - app
    - src
    - spec

    binary: vendor/bin/phpspec      # path to the phpspec binary
    arguments: [format=dot]         # additional phpspec arguments

notifications:                      # flags for notfications on success and on error
    onError: true
    onSuccess: true

To speed up the configuration thing there is an initialization command to bootstrap the config file with default values:, (*9)

phpspec-watcher init


The watcher triggers operating system notifications after executing the test suite., (*10)

To display the notification icons on Mac you need to install another notifier because AppleScript cannot display custom icons, (*11)

brew install terminal-notifier


The idea for creating this package was born after discovering the awesome phpunit-watcher package by Spatie., (*12)


The MIT License (MIT). Please see the License File for more information., (*13)

The Versions

11/09 2017
11/09 2017