zetacomponents/system-information
Provides access to system and environment information via the eZ Components/Zeta Components library. Query OS details, hardware and memory stats, CPU and uptime, network interfaces, load, and related runtime metrics for monitoring or diagnostics in PHP apps.
php artisan commands or custom dashboards (e.g., Tinker, Telescope).ServiceProvider for dependency injection (e.g., SystemInfoFacade).php artisan system:stats).['cpu' => ['model' => 'Intel i7', 'cores' => 8]]). Requires normalization for structured logging (e.g., JSON for Prometheus).docker stats vs. /proc).sys_getloadavg(), exec('free -m')) add latency. Cache aggressively (e.g., 5-minute TTL) for APIs.hostname, uname, or disk usage in public APIs./proc files) require elevated permissions in containers.shoche/system, symfony/system).php_uname(), sys_getloadavg(), or shell_exec() suffice?prometheus/client_php.spatie/laravel-system-info (if available).php artisan server:health).composer require zetacomponents/system-information.use SystemInformation\SystemInformation;
$info = new SystemInformation();
dd($info->getSystemInformation());
SystemInfoService facade:
// app/Providers/SystemInfoServiceProvider.php
public function register() {
$this->app->singleton('systemInfo', function() {
return new \SystemInformation\SystemInformation();
});
}
$metrics = Cache::remember('system_metrics', now()->addMinutes(5), function() {
return app('systemInfo')->getSystemInformation();
});
cpu_load:
if (app('systemInfo')->getCpuLoad() > 0.8) {
Job::highPriority()->dispatch(...);
}
/health endpoint (internal only):
Route::get('/health', function() {
return response()->json([
'cpu' => app('systemInfo')->getCpuUsage(),
'memory' => app('systemInfo')->getMemoryUsage(),
]);
});
/proc, free, top. Works out-of-the-box.php_wmi extension./usr/bin/sysctl compatibility.--privileged or docker stats APIs if needed.README.md.symfony/system or shoche/system (more active).\Log::debug('System Info', ['raw' => $info->getSystemInformation()]);
| Failure Scenario | Impact | Mitigation |
|---|---|---|
| Package breaks on PHP 8.x | Integration fails | Fork or replace with symfony/system. |
| High syscall latency | API/CLI timeouts | Cache metrics; reduce polling frequency. |
| Inconsistent cross-platform | Wrong decisions (e.g., scaling) | Document OS-specific behaviors. |
| Permission denied (containers) | Missing metrics | Run with elevated privileges or use host APIs. |
| Abandoned package | Security/bug risks | Monitor for CVEs; plan migration. |
composer.json; use facade in services.How can I help you explore Laravel packages today?