1. Go to this page and download the library: Download phpactor/amp-fswatch 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/ */
phpactor / amp-fswatch example snippets
Loop::run(function () use () {
$logger = // create a PSR logger
$config = new WatcherConfig([$path]);
$watcher = new PatternMatchingWatcher(
new FallbackWatcher([
new BufferedWatcher(new InotifyWatcher($config, $logger), 10),
new FindWatcher($config, $logger),
new PhpPollWatcher($config, $logger),
new FsWatchWatcher($config, $logger)
], $logger),
[ '/**/*.php' ],
[]
);
$process = yield $watcher->watch([$path]);
while (null !== $file = yield $process->wait()) {
fwrite(STDOUT, sprintf('[%s] %s (%s)'."\n", date('Y-m-d H:i:s.u'), $file->path(), $file->type()));
}
});
use Phpactor\AmpFsWatch\Watcher\Watchman\WatchmanWatcher;
$watcher = new WatchmanWatcher($config, $logger);
use Phpactor\AmpFsWatch\Watcher\Inotify\InotifyWatcher;
$watcher = new InotifyWatcher($config, $logger);
// ...
use Phpactor\AmpFsWatch\Watcher\FsWatch\FsWatchWatcher;
$watcher = new FsWatchWatcher($config, $logger);
// ...
use Phpactor\AmpFsWatch\Watcher\Find\FindWatcher;
$watcher = new FindWatcher($config, $logger);
// ...
use Phpactor\AmpFsWatch\Watcher\Find\FindWatcher;
$watcher = new PhpPollWatcher($config, $logger);
// ...
use Phpactor\AmpFsWatch\Watcher\Fallback\FallbackWatcher;
$watcher = new FallbackWatcher(
[
new InotifyWatcher($logger),
new FindWatcher(500, $logger)
]
$logger
);
// ...
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.