{"id":18353055,"url":"https://github.com/thecodeholic/php-file-watcher","last_synced_at":"2025-04-06T11:33:15.417Z","repository":{"id":92723369,"uuid":"229877879","full_name":"thecodeholic/php-file-watcher","owner":"thecodeholic","description":"Watch file or folder and execute code when something is changes inside","archived":false,"fork":false,"pushed_at":"2020-01-02T13:09:10.000Z","size":10,"stargazers_count":22,"open_issues_count":1,"forks_count":12,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-21T22:41:23.413Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/thecodeholic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2019-12-24T05:41:15.000Z","updated_at":"2024-10-04T16:16:13.000Z","dependencies_parsed_at":null,"dependency_job_id":"35261b52-d677-48f1-af61-6a7f914a2e88","html_url":"https://github.com/thecodeholic/php-file-watcher","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fphp-file-watcher","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fphp-file-watcher/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fphp-file-watcher/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/thecodeholic%2Fphp-file-watcher/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/thecodeholic","download_url":"https://codeload.github.com/thecodeholic/php-file-watcher/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247478152,"owners_count":20945258,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":"2024-11-05T21:38:16.165Z","updated_at":"2025-04-06T11:33:15.410Z","avatar_url":"https://github.com/thecodeholic.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# php-file-watcher\nWatch file or folder and execute code when something is changed inside\n\n### Demo\nYou can run the following command to see how the script works\n\n```sh\nphp index.php FILE_OR_FOLDER_PATH\n```\n\n### Basic usage\n\n```php\n$watcher = new \\tc\\fswatcher\\Watcher('FILE_OR_FOLDER_PATH_TO_WATCH', function ($event) {\n    // Do whatever you want when file or folder is changed.\n    if ($event-\u003eisAddition()){\n        // File was added and file path will be $event-\u003efile\n    } else if ($event-\u003eisModification()){\n        // File was modified and file path will be $event-\u003efile\n    }\n});\n$watcher-\u003ewatch();\n```\n\n### Advanced Usage\n\n```php\n$watcher = new \\tc\\fswatcher\\Watcher('FILE_OR_FOLDER_PATH_TO_WATCH', 'callback', [\n    'watchInterval' =\u003e 5,\n    'cacheChanges' =\u003e true\n]);\n```\n\n### Options\n\n| Option        | Default value | Description                                                      |\n|---------------|---------------|------------------------------------------------------------------|\n| watchInterval | 1             | How often the file changes should be checked                     |\n| cacheChanges  | true          | Gather file modifications in single check and trigger event once |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodeholic%2Fphp-file-watcher","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthecodeholic%2Fphp-file-watcher","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthecodeholic%2Fphp-file-watcher/lists"}