PHP code example of scaleplan / php-inotify
1. Go to this page and download the library: Download scaleplan/php-inotify library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
scaleplan / php-inotify example snippets
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
)
bash
composer
bash
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