Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Os Process Laravel Package

juststeveking/os-process

A lightweight Laravel package for detecting the operating system your app runs on. Check for macOS, Windows, Linux and more through a simple, expressive API, then branch your code accordingly—useful for CLI tools, environment checks, and platform-specific logic.

View on GitHub
Deep Wiki
Context7

A PHP Package to work with OS processes in an OOP way.

Frequently asked questions about Os Process
How do I install juststeveking/os-process in a Laravel application?
Install it with Composer using composer require juststeveking/os-process. Laravel package auto-discovery registers the service provider and facade alias, so no manual wiring is needed in config/app.php on modern Laravel versions. Pin the exact version in composer.json rather than floating a constraint, since the package has a single 1.0.0 release and you want reproducible builds.
Which PHP and Laravel versions does juststeveking/os-process support?
The package reached 1.0.0 in August 2022, so its composer.json constraints target the PHP and Laravel versions current at that time, most likely the Laravel 9 era. The release note itself is only a commit range with no enumerated features or breaking changes, so treat it as a stability milestone rather than a capability statement. Check the require and require-dev blocks against your own version matrix and run your CI suite before committing to it on Laravel 10, 11 or later.
How do I capture stdout, stderr and the exit code from a command?
The package exposes the familiar Symfony Process result surface: standard output, standard error and the numeric exit code, so you can inspect each separately after running a command. That is the main reason to use it over exec() or shell_exec(), which give you a single string and no clean separation of streams. Read the output only after the process finishes, and avoid dumping unbounded output from long-running binaries straight into memory.
Is juststeveking/os-process safe from command injection?
Safety depends entirely on whether arguments are passed to Symfony Process as an array or interpolated into a single shell string, so verify that in the source before trusting it with any external input. Array-style arguments bypass the shell and are the only acceptable pattern when values come from users, requests or database rows. Never build a command by concatenating raw input, and audit the actual call site rather than assuming the wrapper handles escaping for you.
Can I set a timeout, working directory or environment variables per command?
Symfony Process supports all three natively, but the fluent wrapper only helps you if it exposes them per call. Inspect the builder API for timeout, cwd and environment injection before adopting it; if they are missing, drop down to Symfony Process directly for those cases. Timeouts matter most for external binaries like ffmpeg, mysqldump or docker, which can otherwise hang a queue worker indefinitely.
How do I test code that runs OS commands through this package?
Do not call the facade directly from jobs or controllers. Define a small project-owned ProcessRunner contract, implement it with a thin adapter around juststeveking/os-process, and bind a fake implementation in the container during tests. That keeps your test suite fast and hermetic while still allowing one integration test that exercises a real, harmless command such as a version probe. This contract is also your exit ramp if the package is abandoned.
What happens when the process fails or returns a non-zero exit code?
The package advertises clean error handling, which in practice means a failed process surfaces as an exception rather than a silent false return. Catch that exception at the boundary of the operation and translate it into a domain-level error, logging the stderr output and exit code so failures are diagnosable. Remember that a non-zero exit code and a thrown exception are two different signals, and some commands use non-zero codes to communicate normal conditions.
Does juststeveking/os-process work on Windows as well as Linux and macOS?
Because it delegates to Symfony Process, basic execution should work across platforms, but shell behaviour, path separators and binary availability differ enough to cause real divergence. If any of your developers or CI runners are on Windows, run the same commands there before shipping. Otherwise keep the package confined to server-side code paths that you know run on a Linux runtime.
How is this different from Symfony Process or Laravel's built-in Process facade?
It is a thin, fluent object-oriented wrapper over symfony/process, so the underlying capability is identical; what you get is a more expressive builder for composing a binary with arguments and options. Laravel also ships a first-party Process facade in recent versions, and plain Symfony Process is always available, so check whether one of those already covers your use case before adding a dependency. If you do adopt it, hide it behind your own interface so swapping it out later is a one-class change.
Is juststeveking/os-process actively maintained and safe to use in production?
It has a single 1.0.0 release from August 2022, roughly 76 stars, zero dependents and one maintainer, so plan on being the maintainer of last resort and treat the source as the specification. The bigger production question is environmental: the runtime must permit proc_open, and managed hosts or locked-down containers often disable it, which no wrapper can fix. Confirm that, pin the version, and keep the package in the infrastructure layer where an abandoned dependency is a contained swap rather than a refactor.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package