2017 © Pedro Peláez
 

library laravel-folder-watcher

Provides a Laravel console command that can watch a given folder, and any changes are passed to the provided command script.

image

bluora/laravel-folder-watcher

Provides a Laravel console command that can watch a given folder, and any changes are passed to the provided command script.

  • Tuesday, November 29, 2016
  • by bluora
  • Repository
  • 1 Watchers
  • 0 Stars
  • 49 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 0 % Grown

The README.md

Laravel Folder Watcher

Provides a Laravel console command that can watch a given folder, and any changes are passed to the provided command script., (*1)

Useful for running as a background task that initiates a virus scan on uploaded files., (*2)

Checkout our standalone command line tool inspired by the work we did here. github.com/hnhdigital-os/fs-watcher., (*3)

Latest Stable Version Total Downloads Latest Unstable Version License, (*4)

Build Status StyleCI Test Coverage Issue Count Code Climate, (*5)

This package has been developed by H&H|Digital, an Australian botique developer. Visit us at hnh.digital., (*6)

Install

Via composer:, (*7)

$ composer require-dev hnhdigital-os/laravel-folder-watcher dev-master, (*8)

Enable the console command by editing app/Console/Kernel.php:, (*9)

    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
      ...
      Bluora\LaravelFolderWatcher\FolderWatcherCommand::class,
      ...
    ];

Usage

Run the console command using the following:, (*10)

Load

Load a given configuration file. This will load a background process for each folder/binary combination., (*11)

# php artisan watcher load --config-file=***, (*12)

Background

Loads a given watch path and binary as a background process., (*13)

# php artisan watcher background --watch-path=*** --binary=*** --script-arguments=***, (*14)

Run

Runs a given watch path and binary., (*15)

# php artisan watcher run --watch-path=*** --binary=*** --script-arguments=***, (*16)

List

Lists all the background watch processes currently active., (*17)

# php artisan watcher list, (*18)

Kill

Provide a process id (from the list action) to stop it running. Using --pid=all will stop all processes., (*19)

# php artisan watcher kill --pid=***, (*20)

Configuration file

You can provide any yaml based file as input to this command using the load action and the --config-file argument., (*21)

The yaml file is in the following format:, (*22)

[folder path]:
    - [binary]: [arguments]
  • [folder path]: The directory that will be watched for changes. The watcher recursively adds all child folders.
  • [binary]: The binary that we will run. This could be an absolute path or an alias. (eg php)
  • [arguments]: The arguments that need to be given to the binary. Use the placeholders below to allow the watcher to pass this through.

Command placeholders

  • {{file-path}}: The absolute file path to the changed file.
  • {{root-path}}: The base directory of the watcher.
  • {{file-removed}}: Boolean (1 or 0) to indicate if the file was deleted.

Contributing

Please see CONTRIBUTING for details., (*23)

Credits

License

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

The Versions

29/11 2016

dev-master

9999999-dev

Provides a Laravel console command that can watch a given folder, and any changes are passed to the provided command script.

  Sources   Download

MIT

The Requires

 

The Development Requires

laravel command watcher folder inotify