PHPackages                             scaleplan/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. [Utility &amp; Helpers](/categories/utility)
4. /
5. scaleplan/php-inotify

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

scaleplan/php-inotify
=====================

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

v1.1.0(6y ago)05MITPHPPHP &gt;=7.1

Since Aug 11Pushed 5y agoCompare

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

READMEChangelogDependencies (4)Versions (4)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)

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

For example installation for php 7.1 on debian|ubuntu

```
apt-get update
apt-get install php-pear make php7.1-dev
pecl install inotify
echo "extension=inotify.so" >>  /etc/php/7.1/cli/php.ini
```

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

24

—

LowBetter than 31% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity56

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 83.3% 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 ~18 days

Total

3

Last Release

2482d ago

Major Versions

v0.1.0 → v1.0.02019-08-12

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10077243?v=4)[Aleksandr Avtomonov](/maintainers/avtomon)[@avtomon](https://github.com/avtomon)

---

Top Contributors

[![krowinski](https://avatars.githubusercontent.com/u/1478555?v=4)](https://github.com/krowinski "krowinski (10 commits)")[![avtomon](https://avatars.githubusercontent.com/u/10077243?v=4)](https://github.com/avtomon "avtomon (2 commits)")

---

Tags

inotify

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[friendsofphp/php-cs-fixer

A tool to automatically fix PHP code style

13.5k251.2M25.2k](/packages/friendsofphp-php-cs-fixer)[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.9M388](/packages/easycorp-easyadmin-bundle)[matomo/matomo

Matomo is the leading Free/Libre open analytics platform

21.7k38.9k](/packages/matomo-matomo)[phpro/soap-client

A general purpose SoapClient library

8896.1M54](/packages/phpro-soap-client)[civicrm/civicrm-core

Open source constituent relationship management for non-profits, NGOs and advocacy organizations.

751291.4k43](/packages/civicrm-civicrm-core)[blackfire/player

A powerful web crawler and web scraper with Blackfire support

49617.1k](/packages/blackfire-player)

PHPackages © 2026

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