compwright/php-os-release

FreeDesktop.org os-release file reader for PHP

v1.0.0 2025-08-05 17:00 UTC

This package is auto-updated.

Last update: 2025-08-05 17:01:52 UTC


README

Latest Version Total Downloads

For more information about the os-release standard, see https://www.freedesktop.org/software/systemd/man/os-release.html

This library will attempt to read and parse the two standard os-release information files, in order of precedence:

  1. /etc/os-release
  2. /usr/lib/os-release

If no file exists, or if the file cannot be read, an OsReleaseException will be thrown.

Installation

To install, use composer:

composer require compwright/php-os-release

Usage

use CompWright\PhpOsRelease\OsReleaseReader;

$reader = new OsReleaseReader();
$osRelease = $reader();

// Access via property or array access
$version = $osRelease->version;

// or:
$version = $osRelease['VERSION'];

Testing

$ make test

Contributing

Please see CONTRIBUTING for details.

License

The MIT License (MIT). Please see License File for more information.