PHPackages                             krowinski/php-inotify - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. krowinski/php-inotify

ActiveLibrary[File &amp; Storage](/categories/file-storage)

krowinski/php-inotify
=====================

Wraps php inotify module into object and dispatch them using event dispatcher.

v2.1.0(4y ago)204388MITPHPPHP &gt;=7.4CI failing

Since Aug 11Pushed 3y ago3 watchersCompare

[ Source](https://github.com/krowinski/php-inotify)[ Packagist](https://packagist.org/packages/krowinski/php-inotify)[ RSS](/packages/krowinski-php-inotify/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (4)Versions (7)Used By (0)

php-inotify
===========

[](#php-inotify)

[![Build Status](https://camo.githubusercontent.com/78148817988997163990253d24623ed3d290ec15301f6f7fbdcd3920980b9734/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b726f77696e736b692f7068702d696e6f746966792f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/krowinski/php-inotify/build-status/master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/208fc15f1745ffdfd3ce4998c463b9727e010ea23d1075ea25a28afae61ff8f6/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b726f77696e736b692f7068702d696e6f746966792f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/krowinski/php-inotify/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/63eb7a760938f0aefdd36ea54d67eb0a7dc85c0068201673dc1b176e22fafb19/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6b726f77696e736b692f7068702d696e6f746966792f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/krowinski/php-inotify/?branch=master)[![PHP Tests](https://github.com/krowinski/php-inotify/actions/workflows/tests.yml/badge.svg?branch=master)](https://github.com/krowinski/php-inotify/actions/workflows/tests.yml)

Why
===

[](#why)

In cases when you need to scan dir to find new files or files modifications, you probably will create some script and implements pulling mechanism. That is good for small systems with less files but not efficient enough for big one.
And that why we got inotify mechanism that generate event on file|dir changes like create, delete, change and many more that we can listen to. More info in php manual. [here](https://www.php.net/manual/en/book.inotify.php)

Installation
============

[](#installation)

```
composer require krowinski/php-inotify
```

Installing inotify extension for php
====================================

[](#installing-inotify-extension-for-php)

To listen on event we need php extension called inotify. In most cases you just need to install using pecl (example in [dockerfile](https://github.com/krowinski/php-inotify/blob/master/Dockerfile))

Example
=======

[](#example)

You can find example in [example.php](https://github.com/krowinski/php-inotify/blob/master/example/example.php)and events that you can listen to [InotifyEventCodeEnum.php](https://github.com/krowinski/php-inotify/blob/master/src/Inotify/InotifyEventCodeEnum.php)Event implement Arrayable, JsonSerializable and \_\_toString.

```
Array
(
    [id] => 1
    [eventCode] => 256
    [eventDescription] => ON_CREATE - File or directory created in watched directory
    [uniqueId] => 0
    [fileName] => 2
    [pathName] => /tmp
    [customName] => test
    [pathWithFile] => /tmp/2
    [timestamp] => 1565610455
)
Array
(
    [id] => 1
    [eventCode] => 32
    [eventDescription] => ON_OPEN - File was opened
    [uniqueId] => 0
    [fileName] => 2
    [pathName] => /tmp
    [customName] => test
    [pathWithFile] => /tmp/2
    [timestamp] => 1565610455
)
Array
(
    [id] => 1
    [eventCode] => 4
    [eventDescription] => ON_ATTRIB - Metadata changed (e.g. permissions, mtime, etc.)
    [uniqueId] => 0
    [fileName] => 2
    [pathName] => /tmp
    [customName] => test
    [pathWithFile] => /tmp/2
    [timestamp] => 1565610455
)
Array
(
    [id] => 1
    [eventCode] => 8
    [eventDescription] => ON_CLOSE_WRITE - File opened for writing was closed
    [uniqueId] => 0
    [fileName] => 2
    [pathName] => /tmp
    [customName] => test
    [pathWithFile] => /tmp/2
    [timestamp] => 1565610455
)
Array
(
    [id] => 1
    [eventCode] => 512
    [eventDescription] => ON_DELETE - File or directory deleted in watched directory
    [uniqueId] => 0
    [fileName] => 2
    [pathName] => /tmp
    [customName] => test
    [pathWithFile] => /tmp/2
    [timestamp] => 1565610456
)
```

Where:

```
[id] => watch descriptor
[eventCode] => bit mask of events
[eventDescription] => human readable event description (can be UNKNOWN if not found in InotifyEventCodeEnum)
[uniqueId] => is a unique id to connect related events (e.g. IN_MOVE_FROM and IN_MOVE_TO)
[fileName] => name of a file (e.g. if a file was modified in a watched directory)
[pathName] => watched resource you give in configuration
[customName] => custom resource name for external parsing like "form-upload-dir" etc
[pathWithFile] => helper that contact pathName and fileName
[timestamp] => ...

```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~260 days

Total

5

Last Release

1474d ago

Major Versions

v0.1.0 → v1.0.02019-08-12

v1.1.0 → v2.0.02021-10-26

PHP version history (2 changes)v0.1.0PHP &gt;=7.1

v2.0.0PHP &gt;=7.4

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/1478555?v=4)[Kacper Rowiński](/maintainers/krowinski)[@krowinski](https://github.com/krowinski)

---

Top Contributors

[![krowinski](https://avatars.githubusercontent.com/u/1478555?v=4)](https://github.com/krowinski "krowinski (18 commits)")[![romston](https://avatars.githubusercontent.com/u/4458238?v=4)](https://github.com/romston "romston (1 commits)")

---

Tags

dispatchfilesysteminotifyphpphp-inotifyinotify

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/krowinski-php-inotify/health.svg)

```
[![Health](https://phpackages.com/badges/krowinski-php-inotify/health.svg)](https://phpackages.com/packages/krowinski-php-inotify)
```

###  Alternatives

[symfony/http-kernel

Provides a structured process for converting a Request into a Response

8.1k853.6M8.4k](/packages/symfony-http-kernel)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M379](/packages/easycorp-easyadmin-bundle)[symfony/framework-bundle

Provides a tight integration between Symfony components and the Symfony full-stack framework

3.6k246.0M11.2k](/packages/symfony-framework-bundle)[symfony/form

Allows to easily create, process and reuse HTML forms

2.8k162.1M3.3k](/packages/symfony-form)[symfony/security-bundle

Provides a tight integration of the Security component into the Symfony full-stack framework

2.5k181.3M2.2k](/packages/symfony-security-bundle)[symfony/mailer

Helps sending emails

1.6k409.1M1.3k](/packages/symfony-mailer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
