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

Lambda Laravel Package

async-aws/lambda

Async AWS Lambda client for PHP with promise-based async invocations, typed request/response objects, streaming payload support, and credential/region configuration. Lightweight alternative to the AWS SDK for calling and managing Lambda functions.

View on GitHub
Deep Wiki
Context7

[READ ONLY] Lambda client

Frequently asked questions about Lambda
Can I use async-aws/lambda to replace Laravel’s built-in queue system (e.g., database or Redis queues) for background jobs?
This package isn’t a direct replacement for Laravel queues but can augment them. Use it to offload heavy tasks (e.g., video processing) to Lambda while keeping lightweight jobs in Laravel’s queue system. For hybrid workflows, trigger Lambda via Laravel’s `dispatch()` or `Bus` after queue processing. Cold starts and latency may make it unsuitable for time-sensitive jobs.
How do I integrate async-aws/lambda with Laravel’s service container for dependency injection?
Bind the Lambda client in your `AppServiceProvider` using `bind(LambdaClient::class, fn() => new LambdaClient())`. Then inject `LambdaClient` into classes via constructor or use a facade for cleaner syntax. The package supports Laravel’s container integration natively, so no additional setup is needed beyond Composer installation.
What Laravel versions and PHP versions does async-aws/lambda support?
The package targets Laravel 8.1+ and PHP 8.1+ due to its reliance on named arguments and modern PHP features. Check the package’s `composer.json` for exact version constraints, but it aligns with Laravel’s LTS releases. For older Laravel versions, you may need to use an older AWS SDK version or fork the package.
How do I handle Lambda cold starts in a Laravel application?
Cold starts are inherent to Lambda and can’t be eliminated, but you can mitigate them with provisioned concurrency (pre-warmed Lambdas) or by caching frequent responses in Redis. For Laravel integrations, use SQS as a buffer to queue requests before invoking Lambda, ensuring consistent performance. Monitor CloudWatch metrics for latency spikes.
Can I use async-aws/lambda to stream payloads (e.g., large files) to/from Lambda?
Yes, the package supports streaming payloads via AWS Lambda’s streaming APIs. Use the `stream()` method to send or receive large files (e.g., video uploads) without loading them entirely into memory. This is ideal for Laravel apps processing media files or logs. Ensure your Lambda function is configured with sufficient memory and timeout settings.
How do I test Lambda invocations in PHPUnit without hitting AWS?
Use Mockery to mock the `LambdaClient` interface or leverage AWS LocalStack for integration tests. LocalStack provides a local AWS environment, allowing you to test Lambda triggers, SQS queues, and S3 events without real AWS costs. For unit tests, focus on mocking the client’s `invoke()` or `event()` methods to simulate responses.
Is async-aws/lambda secure for handling sensitive operations like payment processing?
Security depends on your IAM role configuration and Lambda setup. Avoid hardcoding credentials; use Laravel’s `.env` or AWS Secrets Manager for IAM roles. For sensitive operations, deploy Lambda in a VPC with private subnets and restrict permissions via least-privilege policies. Always encrypt payloads in transit (TLS) and at rest (KMS).
How do I trigger a Lambda function from a Laravel event (e.g., ModelObserver or Job event)?
Extend Laravel’s event system by listening for events in your `EventServiceProvider` and invoking Lambda via the client. For example, in an `OrderCreated` event listener, call `$lambda->invoke('processOrder', ['orderId' => $order->id])`. Use SQS as a fallback for reliability, as Lambda invocations are asynchronous and may fail silently.
What are the cost implications of using Lambda vs. Laravel queue workers (e.g., EC2 or Kubernetes)?
Lambda costs are pay-per-use (per invocation, duration, and memory), making it cheaper for sporadic or low-volume workloads. For high-throughput tasks, Laravel workers on EC2 or Kubernetes may be more cost-effective due to fixed pricing. Use the AWS Pricing Calculator to compare costs for your expected workload. Consider provisioned concurrency if predictability is critical.
Can I use async-aws/lambda with other AWS services like S3 or DynamoDB for a fully serverless Laravel setup?
Yes, this package is part of the AsyncAws ecosystem, which includes clients for other AWS services like S3, DynamoDB, and SQS. You can combine them for a serverless Laravel architecture, e.g., using S3 for file storage, DynamoDB for state management, and Lambda for processing. The package abstracts AWS SDK complexity, so integrating multiple services is straightforward via dependency injection.
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.
terminal42/code-quality-tools
codifyo/ts-generator-bundle
testo/fiber
mintobit/jobqueue
a4sex/maintenance-bundle
a4sex/entity-date-update
a4sex/client-identifier
a4sex/base-utilites
a4sex/key-value-storage
a4sex/micro-status
chilldev/dependency-injection-extra
datinglibre/datinglibre-app-api
biberltd/corebundle
bricre/symfony-bundle-test
biberltd/logbundle
dominium/http-adapter-bundle
dominium/google-analytics
a4sex/auto-clean-entity
christhompsontldr/laravel-inky
spatie/mailcoach-vapor