/LaraInotify

Laravel File System Watcher

Primary LanguagePHPMIT LicenseMIT

Lara Inotify

Lara Inotify is a wrapper for inotify for Laravel to make it easier to watch filesystem and avoid memory leaks.

Requirement

Installation

To install the package, simply follow the steps below.

Install the package using Composer:

$ composer require octopyid/laravel-inotify

$ artisan vendor:publish --provider="Octopy\Inotify\InotifyServiceProvider"

Usage

See WIKI for more details.

use Octopy\Inotify\Inotify;
use Octopy\Inotify\Contract\Event;
use Octopy\Inotify\Contract\Watcher;

$inotify = new Inotify('foo.txt');

$inotify->event(function (Event $event) {

    $event->on(IN_MODIFY, function (Watcher $watcher) {
        // do something
    });
    
    $event->on(IN_DELETE, function (Watcher $watcher) {
        // do something
    });

    // see : https://www.php.net/manual/en/inotify.constants.php for more events.
});

$inotify->watch();

Security

If you discover any security related issues, please email bug@octopy.dev instead of using the issue tracker.

Credits

License

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