innmind/operating-system
Provides a portable abstraction over the host operating system for PHP, exposing filesystem, process, clock, environment, and related services through a consistent, testable API so applications can avoid direct reliance on platform-specific functions.
PHP_OS_FAMILY, php_uname(), and DIRECTORY_SEPARATOR. Buying gets us tested edge cases (non-POSIX Windows paths, shell invocation differences); building gets us zero dependency surface. This decision should be made per-surface, not company-wide.if (PHP_OS_FAMILY === 'Windows') branches.git/rsync/ffmpeg with per-OS flags, path and temp-directory handling across environments.Adopt when most of the following hold:
Look elsewhere — or write the helper in-house — when:
PHP_OS_FAMILY is a language primitive; a package that abstracts the entire system is disproportionate to "am I on Windows?"symfony/process probes.For executives (one paragraph): This is a small, MIT-licensed utility that lets our code ask "what system am I running on?" in a clean, testable way instead of scattering platform checks throughout the codebase. It has near-zero acquisition cost and no licensing friction. Its strategic value is narrow: it matters only if we commit to supporting more than one operating system for our command-line tooling or any package we distribute. It is not a feature, not a differentiator, and not something to fund as an initiative — it's a low-cost option we should permit engineering to take if and when a cross-platform commitment is made. I'd flag one governance point: it is maintained by a single author with minimal adoption, so if it becomes load-bearing we should isolate it behind our own interface rather than let it spread.
For engineering (the actual argument): The deliverable isn't OS detection — you can do that with PHP_OS_FAMILY. The deliverable is an injectable OS boundary, which makes platform-conditional branches unit-testable on a single CI runner. That directly reduces a class of bugs we cannot reproduce locally. The trade-offs are real and should be stated plainly: the composite opportunity score is low (~17, opportunity ~33), driven by adoption rather than code quality; there are zero dependent packages in the wild and nine stars, so we are effectively the only consumer and must own the risk; the maintainer's design vocabulary (immutable value objects, explicit DI, functional style) is idiomatic to Innmind and unidiomatic to a typical Laravel team, which is a real onboarding cost. Recommendation: do not adopt directly into application code. Wrap it behind a two-method internal SystemEnvironment contract, keep the third-party package as the only implementation, and preserve the option to replace it with ~50 lines of our own code in a single PR. That gives us the testing seam and the swap-out guarantee, and caps the downside at an afternoon of work.
How can I help you explore Laravel packages today?