Weave Code
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

Sidecar Laravel Package

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.

View on GitHub
Deep Wiki
Context7

Deploy and execute AWS Lambda functions from your Laravel application.

Frequently asked questions about Sidecar
How do I deploy a Lambda function written in Node.js alongside my Laravel app?
Define a PHP class extending `LambdaFunction`, specify the handler path in the `handler()` method, and list the required files (e.g., `node_modules`, your script) in the `package()` method. Run `php artisan sidecar:deploy` to package and deploy it to AWS Lambda. Sidecar handles the rest, including runtime configuration.
Can Sidecar work with Laravel Vapor, or is it only for traditional Laravel deployments?
Sidecar is fully optimized for Laravel Vapor. It shares the same AWS infrastructure (IAM roles, VPC, etc.), so you can deploy Lambda functions alongside your Vapor app without additional setup. Just ensure your Vapor IAM policy includes Lambda permissions, and Sidecar will integrate seamlessly.
What happens if my Lambda function times out or fails? How do I handle errors?
Sidecar propagates Lambda errors back to PHP, but you should implement retry logic in your `LambdaFunction` class using exponential backoff. Use the `SettledResult` pattern to catch failures gracefully. For debugging, enable CloudWatch Logs via `sidecar:logs` and monitor AWS Lambda metrics for timeouts or throttling.
Does Sidecar support asynchronous Lambda invocations (e.g., triggered by S3 events)?
Yes, Sidecar functions can be invoked asynchronously via AWS Lambda events (e.g., S3 uploads, DynamoDB streams). Configure the Lambda trigger in the AWS Console or via CloudFormation, and Sidecar will handle the execution. For synchronous calls from Laravel, use `Sidecar::invoke()` directly in your code.
How do I reduce Lambda cold starts when using Sidecar?
Use the `sidecar:warm` command to pre-warm functions or configure provisioned concurrency in AWS Lambda. For Node.js/Python, optimize dependencies by excluding dev tools or using Lambda Layers. Sidecar also supports ARM64/Graviton2 runtimes, which reduce cold starts and costs.
What Laravel versions does Sidecar support, and how do I check compatibility?
Sidecar is designed for Laravel 9+ and follows Laravel’s semantic versioning. Check the [package docs](https://hammerstone.dev/sidecar/docs) for the latest compatibility matrix. If you’re on an older Laravel version, ensure your AWS SDK and PHP dependencies align with Sidecar’s requirements.
Can I use Sidecar for production workloads, or is it better for testing?
Sidecar is production-ready and used in serverless Laravel applications. However, evaluate your use case: for high-throughput or stateful logic, consider dedicated microservices. Sidecar excels for lightweight, stateless tasks (e.g., image processing, ML inference) where Lambda’s scalability shines.
How do I debug a Sidecar function that’s crashing silently?
Enable CloudWatch Logs for your Lambda function and stream them with `php artisan sidecar:logs`. Use AWS X-Ray for tracing performance bottlenecks. For serialization errors, validate input/output formats in your `LambdaFunction` class and test locally with the AWS SAM CLI.
Are there alternatives to Sidecar for deploying Lambda functions from Laravel?
Alternatives include custom AWS SDK scripts or packages like `spatie/laravel-serverless`. However, Sidecar stands out by integrating natively with Laravel’s Artisan, service container, and Vapor, while supporting 14+ runtimes out of the box. For polyglot serverless needs, Sidecar reduces boilerplate significantly.
How do I secure IAM permissions for Sidecar functions in AWS?
Start with Laravel Vapor’s IAM templates and restrict Sidecar’s role to only necessary actions (e.g., `lambda:InvokeFunction`, `s3:PutObject`). Use `aws iam simulate-principal-policy` to test permissions. Avoid over-permissive roles by scoping Sidecar functions to specific AWS resources.
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.
nexmo/api-specification
capell-app/block-library
axium/identity
cetria/laravel-dummy-models
cetria/reflection-helper
agropredict/sso-auth-bundle
evolvestudio/spam-protection
datacore/hub-sdk
develia/commons
cuci/prototurk-sdk
cuci/prototurk-sdk-symfony
develia/geo-bundle
dreamzy/livewire-charts
touchestate-sdk/php-sdk
22h/doctrine-garbage-collection-bundle
agtp/agtp-php
agtp/mod-php
splash/sonata-admin
splash/metadata
splash/openapi