Guard allows you to run custom and packaged events whenever files are changed with your configurable paths. Note, this package is meant to be used with Laravel 4.
To get started update your dependencies in composer.json
"require": {
"codesleeve/guard": "dev-master"
},The service provider needs to be registered in app/config/app.php
'providers' => array(
...
'Codesleeve\Guard\GuardServiceProvider',
),And voila! You should now be able to run
php artisan guard:watchThis doesn't do much except print out changes to our assets though. So let's learn how to configure this thing.
First you should publish the config
php artisan config:publish codesleeve/guardNext open up app/config/packages/codessleve/guard/config.php
These paths are relative to your base laravel project and will be monitored by Guard. There can be both directories and files in this array.
'paths' => array(
'app/assets',
'app/models',
'app/controllers',
'app/views',
),Event classes should implement Codesleeve\Guard\Events\EventInterface and are called in order whenever a file in your paths above changes.
'events' => array(
new Codesleeve\Guard\Events\LogEvent
),In order to capture the ctrl+c event from keyboard we use pcntl_signal which depending on what package manager/operating system you use could be disabled in your php.ini. Be sure to remove pcntl_signal from your disabled_functions.