hnhdigital-os/fs-watcher
Composer 安装命令:
composer create-project hnhdigital-os/fs-watcher
包简介
Provides the ability to watch folders for changes and call a binary in response.
关键字:
README 文档
README
Provides the ability to watch folders for changes and call a binary in response.
This package has been developed by H&H|Digital, an Australian botique developer. Visit us at hnh.digital.
Requirements
- PHP 7.3 (min)
- php-inotify (
pecl install inotify)
Installation
Download the latest build:
curl -o ./fs-watcher -LsS https://github.com/hnhdigital-os/fs-watcher/raw/master/builds/fs-watcher
chmod a+x ./fs-watcher
Move it local bin:
sudo mv ./fs-watcher /usr/local/bin/fs-watcher
Updating
This tool provides a self-update mechanism. Simply run the self-update command.
fs-watcher self-update
How to use
USAGE: fs-watcher <command> [options] [arguments]
config <set|get|reset> [key] [value]
Manage the configuration for this utility.
self-update Check if there is a new version and update.
self-update [--tag=?]
Update this binary to a specific tagged release.
self-update [--check-release=?]
Returns the current binary version.
watch:now [watch-path] [binary-path] [--script-arguments=""]
Specify the path to watch, when a file change is detected
this utility will call the specified binary at the path with the
specific script arguments.
watch:background [watch-path] [binary-path] [--script-arguments=""]
Runs process in the background. Specify the path to watch,
when a file change is detected this utility will call the
specified binary at the path with the specific script arguments.
watch:load Load watchers from a config file.
watch:list List all current watchers.
watch:kill [pid]
Kill a specific process ID for a current watcher.
watch:kill all Kills all the watchers.
watch:log [pid]
View the current log for a specific process ID.
watch:log [--where]
Returns the path of the log files.
watch:log [pid] [--clear]
Clears the logs for a specific process ID.
watch:log [--clear]
Clears all the logs.
watch:now or watch:background
For example, if we want to watch for changes in the /some/folder/example path and have all changes notified to the executable file /some/bin/binary-file.
Note: This utility replaces the following placeholders {{root-path}}, {{file-path}} and {{event-id}} in the script-arguments argument with values. Both path arguments do not need quotations as they will be added automatically.
fs-watcher watch:background /some/folder/example /some/bin/binary-file --script-arguments="{{root-path}} {{file-path}} {{event-id}}"
On each file change in the given root folder, the following command execution will occur:
/some/bin/binary-file "/some/folder/example" "/some/folder/example/new-file" 256
watch:load
Instead of calling this utility for each folder you want to watch, you can use the watch:load command to load a YAML config file.
This config file is in the format:
WATCH-PATH: - BINARY-PATH: SCRIPT-ARGUMENTS
Example:
/some/folder/example: - /some/bin/binary-file: {{root-path}} {{file-path}} {{event-id}}
And then run this to load and start the watcher:
fs-watcher watch:load example.yml
Contributing
Please see CONTRIBUTING for details.
Credits
License
The MIT License (MIT). Please see License File for more information.
hnhdigital-os/fs-watcher 适用场景与选型建议
hnhdigital-os/fs-watcher 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 14 次下载、GitHub Stars 达 6, 最近一次更新时间为 2021 年 03 月 31 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「php」 「filesystem」 「cli」 「inotify」 「watcher」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 hnhdigital-os/fs-watcher 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 hnhdigital-os/fs-watcher 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 hnhdigital-os/fs-watcher 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
A PHP class providing static methods for reading, writing, copying, moving, and deleting files and directories, MIME type detection, image size detection, and file permission management
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
phpABLE file-system library
Slim starter / Slim skeleton package to boost your development with Slim framework
统计信息
- 总下载量: 14
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 11
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-03-31