- How do I install `laravel/vapor-core` for a Laravel app on AWS Lambda?
- Run `composer require laravel/vapor-core` in your Laravel project. The package integrates via service providers and requires no manual configuration unless you need custom `vapor.php` settings. Follow the [Vapor docs](https://docs.vapor.build) for deployment steps, including `vapor.yml` setup.
- Does `vapor-core` support Laravel 13.x, or is it limited to older versions?
- Yes, `vapor-core` is actively maintained for Laravel 11–13.x. Check the [Packagist page](https://packagist.org/packages/laravel/vapor-core) for the latest version, which aligns with Laravel’s LTS releases. Always test in a staging environment before production deployments.
- Can I use Laravel Octane with `vapor-core` to reduce cold starts?
- Absolutely. `vapor-core` supports Laravel Octane, which pre-warms containers and reduces cold starts to under 500ms p99. Enable it via `vapor.yml` or `config/vapor.php` and monitor performance with Vapor’s built-in metrics. Octane is ideal for latency-sensitive APIs.
- How does `vapor-core` handle SQS queues and background jobs in serverless?
- The package abstracts SQS integration behind Laravel’s queue system, so you use `dispatch()` or `queue()` as usual. Vapor auto-scales workers, and `vapor-core` handles event parsing (e.g., SQS triggers) without manual Lambda event mapping. For long-running jobs, set appropriate timeouts in `vapor.yml`.
- Will my existing Laravel app break if I switch to `vapor-core` for AWS Lambda?
- No, `vapor-core` is designed for minimal friction. It replaces PHP-FPM with a Lambda-optimized runtime while preserving Laravel’s ecosystem (Eloquent, Queues, etc.). Test stateful features (e.g., sessions) with Redis/ElastiCache, as file-based storage isn’t supported in serverless environments.
- How do I debug issues in a Lambda function using `vapor-core`?
- Use Vapor’s built-in X-Ray integration for distributed tracing and structured logging via `Vapor::log()`. For local testing, use `vapor test` or the AWS SAM CLI to simulate Lambda invocations. Check CloudWatch logs for runtime errors and monitor concurrency limits in AWS Console.
- Is `vapor-core` locked into AWS, or can I migrate to another serverless provider?
- `vapor-core` is AWS-specific, but you can abstract AWS logic (e.g., `Vapor::queue()`) behind interfaces for portability. For non-AWS providers like Bref, rewrite vendor-specific code or use adapters. Vendor lock-in is low for core Laravel logic but high for AWS-native features like Lambda@Edge.
- How does `vapor-core` handle database connections in a serverless environment?
- The package supports RDS Proxy and ElastiCache for connection pooling, mitigating cold-start latency. Configure your `.env` with `DB_CONNECTION=pgsql` (or MySQL) and ensure your RDS instance allows Lambda IAM roles. Avoid persistent connections; use connection pooling for high concurrency.
- Can I use `vapor-core` for CLI commands or Artisan tasks in Lambda?
- Yes, but with limitations. Vapor provides CLI handlers for Artisan commands, and you can use `vapor exec` for one-off tasks. For scheduled tasks, proxy cron jobs via AWS EventBridge or use Vapor’s scheduler. Test thoroughly, as Lambda’s ephemeral nature may require stateless designs.
- What are the cost implications of using `vapor-core` with AWS Lambda?
- Costs depend on execution time, memory, and concurrency. Monitor with AWS Cost Explorer and optimize by tuning memory/timeout settings in `vapor.yml`. Long-running jobs or unoptimized code can inflate costs; use Provisioned Concurrency for predictable workloads and SQS for async processing to avoid timeouts.