compwright / php-os-release
FreeDesktop.org os-release file reader for PHP
Fund package maintenance!
compwright
Requires
- php: ^8.3
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.74
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^12.0
This package is auto-updated.
Last update: 2025-08-05 17:01:52 UTC
README
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:
- /etc/os-release
- /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.