{"id":30187026,"url":"https://github.com/takuya/php-fsnotifywait-wrapper","last_synced_at":"2026-02-18T07:32:01.549Z","repository":{"id":286143734,"uuid":"960532246","full_name":"takuya/php-fsnotifywait-wrapper","owner":"takuya","description":"fsnotifywait of fanotify command wrapper","archived":false,"fork":false,"pushed_at":"2025-04-09T03:23:23.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-12T15:40:44.112Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/takuya.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-04T15:43:04.000Z","updated_at":"2025-04-09T03:23:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"47352189-80a8-4d1a-a475-f247e2e0fce1","html_url":"https://github.com/takuya/php-fsnotifywait-wrapper","commit_stats":null,"previous_names":["takuya/php-fsnotifywait-wrapper"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/takuya/php-fsnotifywait-wrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-fsnotifywait-wrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-fsnotifywait-wrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-fsnotifywait-wrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-fsnotifywait-wrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/takuya","download_url":"https://codeload.github.com/takuya/php-fsnotifywait-wrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/takuya%2Fphp-fsnotifywait-wrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29572407,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-18T06:19:27.422Z","status":"ssl_error","status_checked_at":"2026-02-18T06:18:44.348Z","response_time":162,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-08-12T15:24:31.647Z","updated_at":"2026-02-18T07:32:01.543Z","avatar_url":"https://github.com/takuya.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"## php fsnotify wrapper\n\nUtilize `fsnotifywait` command.\n```php\n\u003c?php\n$fsnotify = new FsNotifyWrap('/etc');\n$fsnotify-\u003eaddObserver($observer = new FsEventObserver());\n$observer-\u003ewatch(function(FanEvent $ev ){\n  $this-\u003equeue-\u003epush($ev-\u003egetEventSource());\n});\n$fsnotify-\u003elisten();\n```\n\nWatch delete event\n```php\n$fsnotify = new FsNotifyWrap('/etc');\n$fsnotify-\u003eaddObserver($observer = new FsEventObserver());\n$observer-\u003eaddEventListener(\n   FsNotifyDelete:class,\n  fn($ev)=\u003edump($ev-\u003egetEventSource());\n);\n$fsnotify-\u003elisten();\n```\n\nEventSource is a simple object like This.\n```php\n{#372\n  +\"time\": \"2025-04-04 23:50:31\"\n  +\"type\": \"CREATE\"\n  +\"file\": \"/tmp/php-tmpdir-gUEKhP8s/sample.txt\"\n}\n```\n\n## installation \n```shell\ncomposer require takuya/php-fsnotifywait-wrapper\n```\n\n## command \nWatch command included.\n```php\nsudo vendor/bin/fswatch -S --dir /home --exec /usr/bin/echo \n```\nIf something changed, exec echo.sh\n\n## about fsnotifywait\n\n`fsnotifywait` can be added as Linux Command. run `apt install inotofy-tools`. \n\nThis command can watch file changed by `fanotify` API. `fanotify` is added Linux Kernel 5.10.\n\nCompare `inotifywatch`, `fsnotifywait` uses FAN( fanotify API not inotify).\n\n`fanotify` API can watch arbitrarily chosen dir, and recursively too many file in it which inotify cannot watch.\n\n\n```shell\nfsnotifywait -q --format '#%w%f %e ::::' -m -r -S -e create,delete,move,modify /mnt/sample\n```\n\n```\nfsnotifywait -q --timefmt '%F %T' --format '{\"time\":\"%T\",\"type\":\"%e\"}:%w%f%0' -m -r -F -e create,delete,move,modify,moved_from,moved_to /opt/work/sample/\n```\n\nThis command will output this.\n```shell\n{\"time\":\"2025-04-02 03:55:29\",\"type\":\"CREATE\"}:/opt/work/sample/aTooc8Eeph.txt\n{\"time\":\"2025-04-02 03:55:29\",\"type\":\"MODIFY\"}:/opt/work/sample/aTooc8Eeph.txt\n{\"time\":\"2025-04-02 03:55:29\",\"type\":\"CREATE\"}:/opt/work/sample/oFam1Aivoh.txt\n{\"time\":\"2025-04-02 03:55:29\",\"type\":\"MODIFY\"}:/opt/work/sample/oFam1Aivoh.txt\n{\"time\":\"2025-04-02 03:55:29\",\"type\":\"CREATE\"}:/opt/work/sample/jumaiPuSh2.txt\n{\"time\":\"2025-04-02 03:57:42\",\"type\":\"CREATE,ISDIR\"}:/opt/work/sample/sub\n\n```\n\n## see \n\n- man fanotify\n- man fsnotifywatch\n- man fsnotifywait\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-fsnotifywait-wrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftakuya%2Fphp-fsnotifywait-wrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftakuya%2Fphp-fsnotifywait-wrapper/lists"}