8.1. Using Guard in PHP - shinokada/php_notes GitHub Wiki

Adding Guard to PHP project

Install Chrome LiveReload.

Create a Gemfile.

source 'https://rubygems.org'
group :development do
  gem 'guard'
  gem 'guard-livereload', require: false
end

Run bundle install.

Run guard init to create a Guardfile. And add this in the Guardfile.

Monitor any files with the suffix of css, js, html or php.

guard 'livereload' do
  watch(%r{.+\.(css|js|html|php)$})
end

Run the server, run guard and click chrome LiveReload plugin to monitor.

php -S localhost:8888
# in other tab
guard
⚠️ **GitHub.com Fallback** ⚠️