tivie/php-os-detector
tivie/php-os-detector is a small PHP library for identifying the operating system your code is running on. It detects OS family, name, and version across platforms, helping you branch logic, adjust paths, or handle environment-specific behavior reliably.
PHP_OS string comparisons across the codebase.PHP_OS_FAMILY (PHP 7.2+) plus php_uname() covers most of the same ground in a handful of lines; the package's value is a normalized, named API and slightly richer version/family parsing — not novel capability.Consider it when:
PHP_OS_FAMILY isn't available, or you need version-string parsing the language doesn't provide.Look elsewhere (or write your own) when:
composer audit, SLSA/provenance checks, or a maintained-release SLA.PHP_OS_FAMILY is clearer, faster, and ships with the language.For executives: This is a tiny, free, permissively licensed utility that tells the application which operating system it's running on. It's the kind of component that improves support efficiency and informs whether cross-platform investment is warranted — no license cost, no vendor relationship, negligible runtime footprint. The material risk is not money or performance; it is that the code has not been updated since 2017 and has a minimal user base, meaning we would own it in practice. Our recommendation is to treat it as a reference pattern rather than a strategic dependency, and to satisfy the same need with a small internal helper unless a specific gap justifies pulling it in.
For engineering: The capability is one or two static calls returning a normalized OS family and version. Before adding it, confirm it installs and behaves under our current PHP version — the last tagged release predates PHP 7.2 and has no declared support for 8.x, so expect to validate, pin, and possibly patch. If we adopt it, pin an exact version, vendor it, and add a thin internal adapter so we can swap implementations without touching call sites. If we don't, a ~20–30 line helper over PHP_OS_FAMILY and php_uname() delivers equivalent behavior with zero dependency and zero supply-chain surface — and that is the option I'd default to.
One-line recommendation: Do not add as a production dependency. Reimplement the normalization internally, or consume it only as an isolated, vendored, adapter-wrapped utility in non-critical diagnostics code.
How can I help you explore Laravel packages today?