cboxdk/system-metrics
Get real-time system metrics from Linux and macOS in pure PHP. No extensions or dependencies—just type-safe, readonly classes covering CPU, memory, storage, network, load, uptime, and container metrics with explicit Result-based error handling.
top/free/sysctl and parsing text). It gives you one typed API for CPU, memory, load, uptime, storage, network, cgroups, and per-process resources — with zero extensions and zero Composer dependencies. That's a real cost-avoidance story for a small platform team.unified limits API is the headline capability: it resolves cgroup v1/v2, Docker, and Kubernetes quotas into fractional CPU cores and memory limits, and the v3.0.0 changelog shows deliberate work on fractional quotas (200m → 0.2 cores). This directly supports decisions like "are our pods over-provisioned?" and "what's our actual CPU headroom before we scale?"queue:work pools) from measured limits instead of a hardcoded guess. This is a shipped feature, not a roadmap item./health or admin "system status" panel becomes a cheap, self-hosted feature — environment detection, uptime, memory/disk pressure, containerized vs. not. Useful for internal tools, on-prem installs, and customer-facing status pages.Adopt when:
/proc and /sys (some hardened/read-only rootfs setups don't mount them — verify in staging first).Result<T> pattern means no uncaught exceptions from metric reads, which matters on a request path.Look elsewhere when:
SystemMetrics::cpuUsage() blocks for its sample interval by design. Use the two-snapshot API in a scheduled job instead.To executives: We can add in-application system visibility — CPU, memory, disk, uptime, container limits — without buying another monitoring vendor, deploying an agent, or adding infrastructure. That reduces observability spend and shortens incident triage for our ops and support teams. More concretely, it tells us whether production containers are over-provisioned, which is a direct cloud-cost lever. It's MIT-licensed with no runtime dependencies, so the lock-in and integration cost are both near zero — the worst case is we fork it or drop it.
To engineering: It's a pure-PHP, dependency-free, extension-free library behind a small, well-documented API. Strict types, readonly DTOs, Result<T> instead of exceptions, PHPStan level 9, ~90% test coverage, and a fake implementation for tests. It handles cgroup v1/v2, Docker, and Kubernetes — including fractional CPU quotas — which is the part you'd otherwise write and maintain yourself. Note two things upfront: it's framework-agnostic, so Laravel wiring is a thin service provider/facade/config file we own (call it half a day), and the cpuUsage() convenience method blocks for its sample window, so it belongs in scheduled jobs, not controllers. We should pin the version and read the v3.0.0 migration notes before committing.
How can I help you explore Laravel packages today?