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.
Pros:
AbstractBinary enforces a consistent interface for binary wrappers, reducing duplication in CLI tool integrations (e.g., git, docker, ffmpeg). Ideal for Laravel apps with multiple external command dependencies.Evenement) enable custom hooks for logging, error handling, or monitoring without modifying core logic. Aligns with Laravel’s event system for observability.Configuration class simplifies runtime tuning (e.g., timeouts, environment variables) via ArrayAccess/IteratorAggregate, reducing magic strings in code.symfony/process (v4.x), ensuring compatibility with Laravel’s process utilities (e.g., Symfony\Component\Process\Process). Avoids reinventing process execution.Psr\Log\LoggerInterface integrates seamlessly with Laravel’s logging stack (e.g., Monolog, Laravel Log channels).PATH issues) with clear troubleshooting guidance, critical for Laravel SaaS or serverless deployments.Cons:
exec() calls but lacks features for complex workflows (e.g., Docker Compose, Kubernetes CLI wrappers).symfony/process usage (e.g., in Illuminate\Process\ProcessManager).Psr\Log\LoggerInterface (e.g., Log::channel('driver')).symfony/process (v4.x): For process execution (already used by Laravel).psr/log (v1.0): For logging (Laravel-compatible).evenement/evenement (v3.x): For event listeners (lightweight).Throwable, constructor promotion).symfony/process CVE-2021-3129).symfony/process directly for simple cases; leverage BinaryDriver only for reusable drivers.AbstractBinary, ProcessBuilderFactory) into a Laravel package.laravel/binary-driver)?DockerDriver, GitDriver) that warrant this abstraction?symfony/process + custom traits suffice for current needs?spatie/laravel-process or nunomaduro/process.symfony/process alone for simple cases or complex workflows (e.g., ProcessBuilder for command composition).PATH) affect production environments? If so, is manual PATH configuration acceptable?symfony/process (already used by Laravel’s ProcessManager), reducing friction.Psr\Log\LoggerInterface (e.g., Monolog, Laravel Log channels).BinaryDriver\Events\ProcessFailed) for global handling.// app/Providers/BinaryDriverServiceProvider.php
namespace App\Providers;
use Alchemy\BinaryDriver\Driver;
use Illuminate\Support\ServiceProvider;
class BinaryDriverServiceProvider extends ServiceProvider
{
public function register()
{
$this->app->singleton('binary.driver', function ($app) {
return Driver::load('git', $app->make('logger'));
});
}
}
GitPushJob extending Job with BinaryDriver).exec()/symfony/process usage. Identify reusable drivers (e.g., Docker, Git, FFmpeg).symfony/process (abstraction overhead may be negligible).GitDriver) using AbstractBinary.exec() calls with BinaryDriver for new CLI integrations.composer.json to PHP 8.1+ and Symfony 6.x.symfony/process v4.x (Laravel-compatible). Upgrade to v6.x if forking.Log facade or custom channels.ProcessStarted, ProcessFailed).Configuration class can be extended to support Laravel’s config() helper or environment variables.fastcgi_param PATH in Nginx/PHP-FPM (documented in README).BinaryDriver as a Laravel service provider.GitDriver, DockerDriver).git pull, docker build).symfony/process.exec() calls with BinaryDriver for new features.How can I help you explore Laravel packages today?