yosymfony/resource-watcher
A PHP library for watching files and directories for changes. It detects file creations, modifications, and deletions using inotify, polling, or hashing strategies, with a simple event-based API for building file monitors, hot-reload tools, and build watchers.
Architecture fit: yosymfony/resource-watcher is a CLI-oriented, long-running polling library, not a Laravel-native package. It fits Laravel best as an isolated Artisan command, sidecar process, or internal developer tooling component rather than in request/response paths, middleware, or core domain services. Useful TPM-level use cases include dev-server reload triggers, build-pipeline automation, content sync watchers, and low-risk cache-invalidation experiments.
Integration feasibility: Composer installation is straightforward in principle, but there is no Laravel service provider, facade, config file, or Laravel event bridge. The package uses Symfony Finder and Symfony EventDispatcher, while Laravel applications typically expect Laravel events. A wrapper/adapter layer will be required to translate Symfony events into Laravel events or application callbacks. Compatibility with modern Laravel/Symfony versions is the main feasibility gate.
Technical risk: High relative to package maturity. Last release was 2020, stars are low, and the repository is unknown in the supplied metadata, creating maintenance and supply-chain traceability concerns. The polling/checksum model can consume CPU and I/O on large trees, behaves differently across filesystems, and may miss or duplicate events around atomic writes, temp files, deletions, symlinks, and cache corruption. Modern Laravel versions may conflict with its Symfony dependency constraints.
Key questions:
TPM recommendation: Treat this as an internal productivity/POC dependency, not a production-critical platform component. Leverage it only where polling-based file watching is acceptable and where the team can own a thin wrapper and compatibility risk.
Stack fit: Best fit is Laravel 8/9-era applications on PHP 7.x/8.0 with Symfony 4/5 components, or an isolated CLI tool that does not impose its Symfony dependencies on the main Laravel application. For Laravel 10/11 and Symfony 6/7, assume compatibility must be proven with a spike before commitment. Keep the package behind an internal interface so application code depends on Laravel events or callbacks, not Symfony event classes.
Migration path: Inventory existing watchers first: Vite/webpack watchers, cron jobs, inotify-based scripts, Node chokidar, or bespoke shell scripts. Select one non-critical workflow, such as a local dev reload trigger or an internal asset-sync command, and implement the package behind an Artisan command. Compare behavior and resource usage against the existing watcher before expanding.
Compatibility: Run composer why-not against the target Laravel/Symfony versions, test a PHP version matrix, and validate on the actual developer/CI operating systems. Confirm cache-directory permissions, container filesystem behavior, symlink handling, and ignored-directory configuration. Avoid introducing it into shared production dependencies until the wrapper is isolated and version-pinned.
Sequencing:
Maintenance: The package has low release activity and limited community support. Pin the version, document the wrapper, monitor dependency advisories, and identify an internal owner. If the package becomes incompatible, the team should be prepared to fork or replace it rather than depend on upstream fixes.
Support: Expect little Laravel-specific documentation or community knowledge. Internal runbooks, example configs, and troubleshooting guidance are required. Developers will need familiarity with Symfony EventDispatcher and filesystem semantics, not just Laravel conventions.
Scaling: Polling and checksum comparison scale with the number and size of watched files. It is suitable for small-to-medium project trees and internal tooling, but not large monorepos, network filesystems, or high-frequency production workloads. Use Finder filters, ignore rules, smaller watch roots, and cache cleanup to control cost. For high-scale or low-latency needs, native filesystem notifications or a dedicated watcher should be preferred.
Failure modes: Watch for missed deletion events due to stale cache, duplicate events after restarts, permission errors, partial writes during atomic saves, memory growth in long-running processes, CPU/I/O spikes, and unhandled Symfony events after the Laravel bridge changes. Add health checks, process supervision, bounded logs, restart policies, and a documented fallback to manual or cron-based triggers.
Ramp-up: Moderate. A PHP developer can prototype the library quickly, but reliable operation requires filesystem and event-bridge knowledge. Budget roughly one to two days for a compatibility spike and one sprint for a wrapper, observability, and a controlled pilot.
How can I help you explore Laravel packages today?