{"id":23843518,"url":"https://github.com/phpstreamserver/file-monitor","last_synced_at":"2025-07-07T18:36:47.266Z","repository":{"id":264336914,"uuid":"892745722","full_name":"phpstreamserver/file-monitor","owner":"phpstreamserver","description":"[READ ONLY] File Monitor Plugin for PHPStreamServer","archived":false,"fork":false,"pushed_at":"2025-03-06T13:53:19.000Z","size":15,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-04-08T08:46:26.645Z","etag":null,"topics":["phpstreamserver"],"latest_commit_sha":null,"homepage":"https://phpstreamserver.dev","language":"PHP","has_issues":false,"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/phpstreamserver.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":"2024-11-22T17:39:32.000Z","updated_at":"2025-02-17T14:24:18.000Z","dependencies_parsed_at":"2024-12-27T19:18:29.420Z","dependency_job_id":"9ca19053-28da-4a1f-b28c-3ae029a2e849","html_url":"https://github.com/phpstreamserver/file-monitor","commit_stats":null,"previous_names":["phpstreamserver/file-monitor"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/phpstreamserver/file-monitor","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstreamserver%2Ffile-monitor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstreamserver%2Ffile-monitor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstreamserver%2Ffile-monitor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstreamserver%2Ffile-monitor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phpstreamserver","download_url":"https://codeload.github.com/phpstreamserver/file-monitor/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phpstreamserver%2Ffile-monitor/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264130590,"owners_count":23562064,"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":["phpstreamserver"],"created_at":"2025-01-02T19:48:03.444Z","updated_at":"2025-07-07T18:36:47.260Z","avatar_url":"https://github.com/phpstreamserver.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://raw.githubusercontent.com/phpstreamserver/.github/refs/heads/main/assets/phpss_file_monitor_light.svg\"\u003e\n    \u003cimg alt=\"PHPStreamServer logo\" align=\"center\" width=\"70%\" src=\"https://raw.githubusercontent.com/phpstreamserver/.github/refs/heads/main/assets/phpss_file_monitor_dark.svg\"\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n## File Monitor Plugin for PHPStreamServer\n![PHP \u003e=8.2](https://img.shields.io/badge/PHP-\u003e=8.2-777bb3.svg)\n![Version](https://img.shields.io/github/v/tag/phpstreamserver/file-monitor?label=Version\u0026filter=v*.*.*\u0026sort=semver\u0026color=374151)\n![Downloads](https://img.shields.io/packagist/dt/phpstreamserver/file-monitor?label=Downloads\u0026color=f28d1a)\n\nThe File Monitor Plugin for **PHPStreamServer** extends the core functionality by automatically monitoring file changes within specified directories.\nWhen changes are detected, the plugin triggers a workers reload. In always-in-memory architectures, the server must to be reloaded to take effect after file changes.  \nUseful for development environments.\n\n### Features\n - Watch specific files in specific directories.\n - Uses inotify signals from the operating system.\n\n### Install\n```bash\n$ composer require phpstreamserver/core phpstreamserver/file-monitor\n```\n\n### Configure\nHere is an example of a simple server configuration.  \nEach time the files in the directory change, the server is reloaded.\n\n```php\n// server.php\n\nuse PHPStreamServer\\Core\\Server;\nuse PHPStreamServer\\Core\\Worker\\WorkerProcess;\nuse PHPStreamServer\\Plugin\\FileMonitor\\FileMonitorPlugin;\nuse PHPStreamServer\\Plugin\\FileMonitor\\WatchDir;\n\n$server = new Server();\n\n$server-\u003eaddPlugin(\n    new FileMonitorPlugin(\n        new WatchDir(sourceDir: __DIR__, filePattern: ['*'], invalidateOpcache: true)\n    ),\n);\n\n$server-\u003eaddWorker(\n    new WorkerProcess(\n        name: 'Supervised Program',\n        count: 1,\n        onStart: function (WorkerProcess $worker): void {\n            // custom long running process\n        },\n    ),\n);\n\nexit($server-\u003erun());\n```\n\n### Run\n```bash\n$ php server.php start\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpstreamserver%2Ffile-monitor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphpstreamserver%2Ffile-monitor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphpstreamserver%2Ffile-monitor/lists"}