splash/bridge-builder
Laravel package for building and managing bridges between systems, providing tools to define connections, map data flows, and orchestrate integration logic in a structured, reusable way. Suitable for apps needing reliable cross-service communication and syncing.
Illuminate\Queue) to trigger PHAR workers asynchronously, reducing core app latency for I/O-bound operations (e.g., webhooks, payment processing).BridgeBuilderServiceProvider.HttpClient, Cache).artisan bridge-builder:run or custom commands.dispatch(new PharJob())), making it a drop-in replacement for heavy jobs.Route::post('/webhook', PharWebhook::class)).php artisan connector:process --queue=high).phar.ini settings (e.g., phar.readonly=0).guzzlehttp/guzzle), risking version conflicts.stderr redirection.| Risk | Severity | Mitigation |
|---|---|---|
| Dependency Conflicts | High | Use composer.json in PHAR projects to lock versions; avoid shared deps. |
| PHAR Security | Medium | Restrict PHAR execution to trusted paths; validate all inputs/outputs. |
| Debugging Complexity | High | Implement health checks, structured logging, and remote debugging (e.g., Xdebug). |
| Performance Overhead | Medium | Benchmark PHAR startup time; cache PHARs in memory (e.g., opcache). |
| Laravel Version Lock | Medium | Test compatibility with Laravel 8.0+; avoid deprecated APIs. |
Illuminate\Queue\RetryFailedJobs with custom logic for PHAR failures.dispatch(new ProcessPaymentJob())).php artisan schedule:run) to PHARs.Pilot Phase:
// Before (Laravel Service)
$result = (new StripeService())->createCustomer($data);
// After (PHAR Worker)
dispatch(new CreateCustomerJob($data)); // Triggers PHAR via queue
php artisan queue:work.stderr redirection).Incremental Rollout:
feature() helper to toggle between old and new implementations.
if (feature('use-phar-workers')) {
dispatch(new PharJob($data));
} else {
(new LegacyService())->process($data);
}
Tooling Setup:
composer require humbug/box --dev
box compile --dir=phar-worker --main=phar.php
// config/queue.php
'connections' => [
'phar_workers' => [
'driver' => 'redis',
'queue' => 'phar-jobs',
'process_workers' => env('PHAR_WORKERS', 4),
],
]
// app/Console/Commands/RunPharWorker.php
public function handle() {
$phar = new \Splash\BridgeBuilder\PharWorker('path/to/worker.phar');
$phar->run($this->argument('data'));
}
curl, openssl, posix) are available in both Laravel and PHAR environments.composer.json files for PHAR projects to avoid conflicts./phar-worker
├── composer.json # Isolated dependencies
├── src/Connector.php # Business logic
├── phar.php # Entry point
└── vendor/ # Bundled dependencies
HttpClient), use composer.json aliases or PHAR-specific configs.Phase 1: Infrastructure
phar.readonly=0 in php.ini./var/www/phars/).// In PHAR entry point (phar.php)
ini_set('log_errors', 1);
ini_set('error_log', '/var/log/phar-worker.log');
Phase 2: Connector Migration
StripeConnector).
b. Build PHAR:
box compile --dir=phar-worker --main=phar.php
c. Integrate with Laravel:
Phase 3: Observability
// In PHAR entry point
if (isset($_GET['health'])) {
http_response_code(200);
echo 'OK';
exit;
}
How can I help you explore Laravel packages today?