Download the PHP package cboxdk/system-metrics without Composer
On this page you can find all versions of the php package cboxdk/system-metrics. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download cboxdk/system-metrics
More information about cboxdk/system-metrics
Files in cboxdk/system-metrics
Package system-metrics
Short Description Peek into your low level system metrics with PHP
License MIT
Homepage https://github.com/cboxdk/system-metrics
Informations about the package system-metrics
Cbox System Metrics
Get real-time system metrics from Linux and macOS in pure PHP. No extensions, no dependencies, just clean type-safe access to CPU, memory, storage, network, and container metrics.
Table of Contents
- Features
- Requirements
- Installation
- Quick Start
- Documentation
- Testing
- Changelog
- Contributing
- Security
- Credits
- License
Features
✨ Pure PHP Implementation
- No PHP extensions required
- No Composer dependencies
- Works out of the box on any Linux or macOS system
🔒 Type-Safe with Modern PHP
- Built for PHP 8.3+ with readonly classes
- Strict types everywhere (
declare(strict_types=1)) - Full PHPStan Level 9 compliance
🎯 Explicit Error Handling
- Result
pattern instead of exceptions - Explicit success/failure handling at compile time
- No uncaught exceptions in production
📊 Comprehensive Metrics
- Environment detection (OS, kernel, architecture, virtualization, containers)
- CPU metrics (raw time counters, per-core data, usage calculations)
- Memory metrics (physical RAM, swap, buffers, cache)
- Load average with per-core normalization
- System uptime tracking
- Storage metrics (filesystem usage, disk I/O)
- Network metrics (interface stats, connections)
- Container metrics (cgroup v1/v2, Docker, Kubernetes)
- Process metrics (individual and group monitoring)
- Unified limits API (environment-aware resource limits)
🏗️ Production-Ready
- 89.9% test coverage
- PSR-12 code style via Laravel Pint
- Graceful degradation when APIs unavailable
- Performance optimized with static data caching
Requirements
- PHP 8.3 or higher (uses readonly classes)
- Linux or macOS (Windows not supported)
- Standard system access:
- Linux: Read access to
/proc,/sysfilesystems - macOS: Access to
sysctl,vm_stat,sw_verscommands
- Linux: Read access to
Note: No special permissions or root access required.
Installation
Quick Start
Complete System Overview
Individual Metrics
CPU Usage Percentage
CPU metrics return raw time counters. To calculate usage percentage:
Error Handling
All methods return Result<T> for explicit error handling:
Documentation
Comprehensive documentation is available in the docs/ directory:
Getting Started
- Introduction - Overview and key features
- Requirements - Supported PHP versions and platforms
- Installation - Installation and setup
- Quick Start - 30-second working example
Basic Usage
- Environment Detection - OS, kernel, architecture, containers
- CPU Metrics - CPU time counters and core data
- Memory Metrics - Physical RAM and swap
- Load Average - System load metrics
- System Uptime - Boot time tracking
- Storage Metrics - Filesystem and disk I/O
- Network Metrics - Interface statistics
- System Overview - Complete snapshot
Advanced Features
- Container Metrics - Cgroup v1/v2, Docker, Kubernetes
- Process Metrics - Process monitoring and tracking
- Unified Limits - Environment-aware resource limits
- CPU Usage Calculation - Delta between snapshots
- Error Handling - Result
pattern deep dive - Custom Implementations - Extend with custom sources
Architecture
- Design Principles - Architectural philosophy
- Result Pattern - Error handling approach
- Composite Sources - Fallback logic
- Immutable DTOs - Data structures
- Action Pattern - Use case encapsulation
- Performance Caching - Optimization strategies
Platform Support
- Linux - Linux-specific implementation
- macOS - macOS-specific implementation
- Comparison - Feature parity table
Reference
- API Reference - Complete method documentation
- Testing Guide - Running tests and coverage
- Roadmap - Planned features
Testing
See Testing Guide for details.
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security
Please review our security policy on how to report security vulnerabilities.
Credits
- Sylvester Damgaard
- All Contributors
License
The MIT License (MIT). Please see License File for more information.