andrewmackrodt/fsnotify 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

andrewmackrodt/fsnotify

最新稳定版本:v0.1.1

Composer 安装命令:

composer require andrewmackrodt/fsnotify

包简介

Event based file system watcher for PHP

README 文档

README

Build Status License

Event based file system watcher for PHP. FsNotify is fully† async and event based using Amp and Symfony\EventDispatcher.

† excluding stat operations to determine file metadata

Usage

Quick start

<?php

use Denimsoft\FsNotify\Event\FileEvent;
use Denimsoft\FsNotify\FsNotifyBuilder;

require_once __DIR__ . '/vendor/autoload.php';

$fsNotify = (new FsNotifyBuilder())
    ->addWatcher(__DIR__ . '/src', true)
    ->getBuilder()
    ->addChangeListener(function (FileEvent $event) {
        echo sprintf(
                "[%s] (%s) \"%s\" %s\n",
                date('c'),
                $event->getEventName(),
                $event->getFilepath(),
                json_encode($event->getMetadata())
            );
    })
    ->createFsNotify();

$fsNotify->start();

Advanced usage

FsNotify supports monitoring multiple paths with configurable callbacks and filters. See the examples directory for complete usage:

This library was developed with the laravel-ide-helper use case in mind, it highlights a moderately complicated yet useful usage scenario.

Adapters

PhpAdapter - fallback adapter if no other adapters are supported. PhpAdapter uses file polling to detect changes. The adapter defaults to a configurable polling interval of 1 second. It is sufficient for monitoring a small amount of files.

FswatchAdapter - fswatch requires the GNU CLI tool fswatch, it's more performant than PhpAdapter and detects file changes almost instantaneously. It is preferred in most cases but can be slow to propagate large amounts of file deletions (such as deleting the vendor or node_modules folder of a PHP or JavaScript project respectively); however, this use case is considered atypical and should not affect most users. It also does not initially recurse into a copied or moved directory but this is once again not typically a requirement when watching for changes to Laravel models or static asset directories before executing a third-party tool.

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-09-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固