Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hnhdigital-os/laravel-folder-watcher
Please use fs-watcher - we're not maintaining this package
https://github.com/hnhdigital-os/laravel-folder-watcher
Last synced: 11 days ago
JSON representation
Please use fs-watcher - we're not maintaining this package
- Host: GitHub
- URL: https://github.com/hnhdigital-os/laravel-folder-watcher
- Owner: hnhdigital-os
- License: mit
- Created: 2016-11-10T13:07:30.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2019-02-05T09:42:17.000Z (almost 6 years ago)
- Last Synced: 2023-08-22T08:55:34.479Z (over 1 year ago)
- Language: PHP
- Homepage: https://github.com/hnhdigital-os/fs-watcher
- Size: 27.3 KB
- Stars: 8
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Folder Watcher
Provides a Laravel console command that can watch a given folder, and any changes are passed to the provided command script.
Useful for running as a background task that initiates a virus scan on uploaded files.
Checkout our standalone command line tool inspired by the work we did here. [github.com/hnhdigital-os/fs-watcher](https://github.com/hnhdigital-os/fs-watcher).
[![Latest Stable Version](https://poser.pugx.org/hnhdigital-os/laravel-folder-watcher/v/stable.svg)](https://packagist.org/packages/hnhdigital-os/laravel-folder-watcher) [![Total Downloads](https://poser.pugx.org/hnhdigital-os/laravel-folder-watcher/downloads.svg)](https://packagist.org/packages/hnhdigital-os/laravel-folder-watcher) [![Latest Unstable Version](https://poser.pugx.org/hnhdigital-os/laravel-folder-watcher/v/unstable.svg)](https://packagist.org/packages/hnhdigital-os/laravel-folder-watcher) [![License](https://poser.pugx.org/hnhdigital-os/laravel-folder-watcher/license.svg)](https://packagist.org/packages/hnhdigital-os/laravel-folder-watcher)
[![Build Status](https://travis-ci.org/hnhdigital-os/laravel-folder-watcher.svg?branch=master)](https://travis-ci.org/hnhdigital-os/laravel-folder-watcher) [![StyleCI](https://styleci.io/repos/73382984/shield?branch=master)](https://styleci.io/repos/73382984) [![Test Coverage](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher/badges/coverage.svg)](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher/coverage) [![Issue Count](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher/badges/issue_count.svg)](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher) [![Code Climate](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher/badges/gpa.svg)](https://codeclimate.com/github/hnhdigital-os/laravel-folder-watcher)
This package has been developed by H&H|Digital, an Australian botique developer. Visit us at [hnh.digital](http://hnh.digital).
## Install
Via composer:
`$ composer require-dev hnhdigital-os/laravel-folder-watcher dev-master`
Enable the console command by editing app/Console/Kernel.php:
```php
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
...
Bluora\LaravelFolderWatcher\FolderWatcherCommand::class,
...
];
```## Usage
Run the console command using the following:
### Load
Load a given configuration file. This will load a background process for each folder/binary combination.
`# php artisan watcher load --config-file=***`
### Background
Loads a given watch path and binary as a background process.
`# php artisan watcher background --watch-path=*** --binary=*** --script-arguments=***`
### Run
Runs a given watch path and binary.
`# php artisan watcher run --watch-path=*** --binary=*** --script-arguments=***`
### List
Lists all the background watch processes currently active.
`# php artisan watcher list`
### Kill
Provide a process id (from the list action) to stop it running. Using --pid=all will stop all processes.
`# php artisan watcher kill --pid=***`
## Configuration file
You can provide any yaml based file as input to this command using the load action and the --config-file argument.
The yaml file is in the following format:
```yaml
[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](https://github.com/hnhdigital-os/laravel-folder-watcher/blob/master/CONTRIBUTING.md) for details.
## Credits
* [Rocco Howard](https://github.com/therocis)
* [All Contributors](https://github.com/hnhdigital-os/laravel-folder-watcher/contributors)## License
The MIT License (MIT). Please see [License File](https://github.com/hnhdigital-os/laravel-folder-watcher/blob/master/LICENSE) for more information.