Laravel File System Watcher

Overview

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 supianidz@gmail.com instead of using the issue tracker.

Credits

License

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

You might also like...
Stapler-based file upload package for the Laravel framework.

laravel-stapler Laravel-Stapler is a Stapler-based file upload package for the Laravel framework. It provides a full set of Laravel commands, a migrat

Laravel Model File Uploader package

Laravel Model File Uploader package Easy way to upload laravel model related file from the requset. Install (Via Composer) composer require plusemon/u

Trait for multilingual resource file support

⚡ Usage This library supports MultilingualResourceTrait which can be used in PluginBase. Multilingual support of resource files is possible using this

Load head metadata from a manifest file which can be shared with a SPA project

Laravel Head Manifest Installation Step 1: Add Laravel Head Manifest to your laravel project composer require critiq/laravel-head-manifest Step 2: Add

A package that makes it easy to have the `artisan make:` commands open the newly created file in your editor of choice.

Open On Make A package that makes it easy to have the artisan make: commands open the newly created file in your editor of choice. Installation compos

Shows the path of each blade file loaded in a template
Shows the path of each blade file loaded in a template

Laravel Tracer Tracer shows the paths of all the Blade files that are loaded into your templates. This could be very convenient for a number of reason

A Composer script to lint a Travis CI configuration file.

composer-travis-lint composer-travis-lint is a Composer script that lints a project/micro-package its Travis CI configuration aka its .travis.yml file

Because I can never remember exactly how to autoload my helpers.php file.

Laravel Helpers File (helpers.php) I add a app/helpers.php file to every project for any custom helpers I might want to create. Everytime I go to add

An abstraction layer to get data from array or a file with dot-notation

Alex Unruh - Config This library is based on the Laravel config concept. It values performance and was built on top of the library Dflydev Dot Access

Comments
  • Source problem

    Source problem

    Hi! I've tried to use this ext, but no matter what kind of source i gave to it, it always said, there is nothing to watch.

    It seems in Inotify.php construct function it tries to check the inner "source" var. If it's not null ( what will never happen at start ), it will try to add that source:

    ==================================

    public function __construct(string|null $source = null, Closure|null $event = null)
    {
      //if (! is_null($this->source)) { //original, this will always be empty at the start
      if (! is_null($source)) {            // it started to work after i changed it to this
        $this->source(new InotifySource($source));
      }
      ...
    }
    

    ===================================

    Am I doing something wrong or is it a bug?

    My code:

    $inotify = new Inotify( "/tmp/test_dir/", function (Event $event) {
       $event->on(IN_CREATE, function (Watcher $watcher) {
          Log::info("It was creation");
        });
    });
    $inotify->watch();
    

    Can I get the filename somehow out of the $watcher object?

    opened by Wall0fDeath 2
Releases(v1.0.1)
Owner
Octopy ID
:)
Octopy ID
Sebuah aplikasi file hosting sederhana yang berguna untuk menyimpan berbagai file

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Willy Ferry 2 Nov 25, 2021
cybercog 996 Dec 28, 2022
Laravel Larex lets you translate your whole Laravel application from a single CSV file.

Laravel Larex Translate Laravel Apps from a CSV File Laravel Larex lets you translate your whole Laravel application from a single CSV file. You can i

Luca Patera 68 Dec 12, 2022
Orbit is a flat-file driver for Laravel Eloquent

Orbit is a flat-file driver for Laravel Eloquent. It allows you to replace your generic database with real files that you can manipulate using the methods you're familiar with.

Ryan Chandler 664 Dec 30, 2022
Laravel Livewire (TALL-stack) form generator with realtime validation, file uploads, array fields, blade form input components and more.

TALL-stack form generator Laravel Livewire, Tailwind forms with auto-generated views. Support Contributions Features This is not an admin panel genera

TinaH 622 Jan 2, 2023
Stapler-based file upload package for the Laravel framework.

laravel-stapler Laravel-Stapler is a Stapler-based file upload package for the Laravel framework. It provides a full set of Laravel commands, a migrat

Code Sleeve 565 Dec 9, 2022
Auto-generated Interface and Repository file via Repository pattern in Laravel

Auto-generated Repository Pattern in Laravel A repository is a separation between a domain and a persistent layer. The repository provides a collectio

Ngo Dinh Cuong 11 Aug 15, 2022
Laravel File Generators with config and publishable stubs

Laravel File Generators Custom Laravel File Generators with a config file and publishable stubs. You can publish the stubs. You can add your own stubs

Ben-Piet O'Callaghan 116 Oct 29, 2022
File manager for Laravel

Laravel File Manager DEMO: Laravel File Manager Vue.js Frontend: alexusmai/vue-laravel-file-manager Documentation Laravel File Manager Docs Installati

Aleksandr Manekin 937 Jan 1, 2023
Store your Laravel application settings in an on-disk JSON file

Store your Laravel application settings in an on-disk JSON file. This package provides a simple SettingsRepository class that can be used to store you

Ryan Chandler 24 Nov 16, 2022