alchemy/binary-driver
PHP toolkit for building reusable, testable binary drivers on top of symfony/process. Provides AbstractBinary, binary detection, command generation, logging via PSR-3, and process listeners for debugging and customization across CLI tools.
Standardizing CLI tool execution across PHP applications, reducing reliance on raw exec() or symfony/process for complex workflows (e.g., build tools, CLI wrappers, or system integrations).
exec('git pull') calls with a GitDriver class for consistent error handling, logging, and retries.Enabling modular CLI tooling for internal tools (e.g., deployment scripts, analytics pipelines, or devops automation) by abstracting binary interactions into reusable drivers.
DockerDriver to standardize container operations across microservices, with shared timeouts and logging.Roadmap decision: Justify build vs. buy by evaluating whether this package’s abstraction layer (logging, listeners, configuration) aligns with long-term needs for process management over alternatives like symfony/process or custom solutions.
Use cases:
ffmpeg, imagemagick) with modern error recovery and observability.DatabaseBackupDriver, CodeLinterDriver) with shared behavior.stdout/stderr for real-time monitoring or alerting.Adopt if:
exec() or shell_exec().Process, EventDispatcher), reducing integration friction.Look elsewhere if:
symfony/process directly or PHP’s built-in exec().PATH environment variable).symfony/process with custom event loops or libraries like react/promise.symfony/console or laravel/artisan.For Executives:
"This package lets us treat CLI tools as first-class components in our PHP applications—standardizing how we interact with external commands (e.g., docker, git, ffmpeg) with built-in error handling, logging, and retries. Instead of scattering exec() calls across the codebase, we’d encapsulate them in reusable ‘drivers,’ making our tools more reliable, debuggable, and maintainable. It’s a low-risk way to reduce technical debt in areas like deployments, data processing, or system integrations—without adding complexity to our stack."
Key Value Props:
exec() calls.For Engineers: *"BinaryDriver gives us a Symfony-compatible way to build binary wrappers with:
AbstractBinary to create domain-specific tools (e.g., S3SyncDriver, CodeLinterDriver) without rewriting process logic.stdout/stderr or trigger custom logic on failures (e.g., Slack alerts for build failures).symfony/process but adds a thin abstraction layer for drivers and configuration.Tradeoffs:
Recommendation: Use for internal tooling where CLI interactions are a core feature. Pair with symfony/process for critical paths if maintenance becomes an issue."*
For Architects:
*"This fills a gap between raw exec() and full-fledged microservices. It’s ideal for:
MediaEncoderDriver for FFmpeg).symfony/process alone.Alternatives:
symfony/process for critical paths.spatie/laravel-process (Laravel-specific) or build a custom abstraction.symfony/console for public-facing tools.The MIT license is a plus for customization, but we’d need to vet forks or maintain it ourselves if critical bugs arise."
For Security/Compliance Teams: *"This package has no direct security risks (it’s a process abstraction layer), but:
symfony/process and evenement libraries should be audited for vulnerabilities.PATH environment variables are set correctly in PHP-FPM/Nginx to avoid command injection risks.How can I help you explore Laravel packages today?