承接 jefyokta/php-file-watcher 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

jefyokta/php-file-watcher

最新稳定版本:v0.0.5

Composer 安装命令:

composer require jefyokta/php-file-watcher

包简介

A lightweight native file watcher for PHP using FFI

README 文档

README

Lightweight, cross-platform file watcher for Linux and macOS using native OS facilities (inotify on Linux, kqueue on macOS), exposed via PHP FFI.

Requirements

  • Operating System: Linux or macOS
  • PHP: FFI extension enabled (--enable-ffi or ffi.enable=1 in php.ini)
  • Composer: for installation and autoloading

Installation

Install the package via Composer:

composer require jefyokta/php-file-watcher

Usage

use Jefyokta\PhpFileWatcher\Watcher;

Watcher::onChange(function(string $file) {
    echo "File Changed: $file\n";
})->watch(__DIR__);
  • onChange(callable $callback) — Register a callback to be invoked on each changed file.
  • watch(string $directory) — Start watching the specified directory recursively.

Notes

  • This package relies on PHP's FFI and a compiled native library (libfilewatcher.so or .dylib), so ensure the native library is built for your platform.
  • Recursive watching of directories is supported.
  • Suitable for lightweight monitoring in CLI PHP scripts or long-running daemons.

Build Native Library

If you want to build the native library yourself:

./build.sh

This script detects your OS and compiles the appropriate C source code into the shared library.

License

MIT License

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: C

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-06-06

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固