hammerstone/sidecar
Sidecar lets Laravel package, deploy, and invoke AWS Lambda functions directly from your app. Define a simple PHP class plus the files to ship, choose any supported runtime (Node, Python, Java, .NET, Ruby, or OS-only), and execute from PHP.
sidecar.php). Minimal overhead for basic use but may conflict with custom AWS SDK configurations.--pre-warm flag separately).| Risk Area | Mitigation Strategy |
|---|---|
| AWS Permissions | Requires IAM role with Lambda/S3/ECR permissions; misconfigurations can block deployments. |
| Runtime Compatibility | Test handler functions locally (e.g., using sam local invoke) before deployment. |
| Breaking Changes | Monitor runtime defaults (e.g., Node.js 20 in v0.6.0) and naming schemes (v0.4.0). |
| Cost Overruns | Lambda invocations accrue costs; set timeout/memory limits per function. |
| Debugging Complexity | Lambda logs require CloudWatch integration; Sidecar doesn’t expose a unified logging system. |
| Vendor Lock-in | AWS-specific; migration to other serverless platforms (e.g., Cloudflare Workers) would require rewrites. |
--pre-warm)?| Phase | Action Items |
|---|---|
| Assessment | Audit existing serverless needs: Identify tasks suitable for Lambda (e.g., image processing, data parsing) vs. those needing full microservices. |
| Pilot | Deploy 1–2 non-critical functions (e.g., a Node.js-based image generator) to validate: |
| - AWS permissions setup. | |
- Deployment workflow (php artisan sidecar:deploy). |
|
| - Execution latency (cold starts). | |
| Integration | Extend Laravel app to use Sidecar functions: |
- Create LambdaFunction classes (e.g., App\Sidecar\PdfGenerator). |
|
- Configure package() to include runtime dependencies (e.g., node_modules/ for Node.js). |
|
- Integrate execute() calls into routes/services. |
|
| Optimization | Fine-tune for production: |
| - Set memory/timeout limits per function. | |
| - Enable pre-warming for critical functions. | |
- Configure environment variables (e.g., AWS_REGION). |
|
| Monitoring | Implement observability: |
| - CloudWatch alarms for Lambda errors. | |
| - Laravel logging for Sidecar execution metrics. | |
| - Cost tracking (AWS Cost Explorer for Lambda spend). |
AWS_ACCESS_KEY_ID in .env).composer require hammerstone/sidecar.php artisan vendor:publish --provider="Hammerstone\Sidecar\SidecarServiceProvider".OgImage class).php artisan sidecar:deploy --env=local.OgImage::execute([]) in routes.--activate: php artisan sidecar:deploy --activate.deploy, warm, activate, deactivate), requiring documentation for the team.- run: php artisan sidecar:deploy --activate
- run: php artisan migrate --force
sidecar.env to avoid overwriting functions in shared environments (e.g., local).LambdaFunction classes accordingly.How can I help you explore Laravel packages today?