- What Laravel versions does laravel/vapor-core officially support?
- The package is designed for Laravel 10 through 13. If you're using an older version (e.g., Laravel 9), you may need to manually patch dependencies like Symfony 8 components or check for community forks. Always verify compatibility with your Laravel version in the [Vapor docs](https://docs.vapor.build).
- How do I install laravel/vapor-core in an existing Laravel project?
- Run `composer require laravel/vapor-core` in your project root. The package auto-registers the `VaporServiceProvider` only when deployed to Vapor, so no manual configuration is needed for local development. Ensure your `config/app.php` includes the provider in the `providers` array if not auto-loaded.
- Will laravel/vapor-core work with Laravel Octane (Swoole/RoadRunner) for real-time features?
- Yes, but with caveats. Octane is supported in hybrid setups (tested in v2.37.8+), but Swoole/RoadRunner may conflict with Lambda’s event loop for HTTP traffic. Use Octane for WebSocket/real-time features while relying on Lambda for stateless API routes. Check the [Vapor docs](https://docs.vapor.build) for Octane-specific configurations.
- How does laravel/vapor-core handle database connections in serverless environments?
- The package addresses MySQL `wait_timeout` issues (fixed in v2.43.3+) and integrates with AWS RDS/ElastiCache via Laravel’s existing abstractions. For high concurrency, consider using RDS Proxy alongside Vapor’s connection pooling. Externalize sessions to Redis to avoid ephemeral storage limits (/tmp).
- Can I use laravel/vapor-core with non-AWS storage like MinIO or DigitalOcean Spaces?
- Yes, the package leverages Laravel’s Filesystem contracts, so any S3-compatible storage (e.g., MinIO, Backblaze B2) will work. Configure your `filesystems.php` to use the appropriate disk driver, and ensure your AWS SDK bindings support the target provider. Test uploads/downloads in a staging environment first.
- How do I debug cold starts in Laravel Vapor using laravel/vapor-core?
- Cold starts (~100–500ms) are inherent to Lambda but can be mitigated with provisioned concurrency. Use AWS X-Ray for distributed tracing or Vapor’s built-in logging to identify bottlenecks. Benchmark your app’s cold starts using the [AWS Lambda Power Tuning tool](https://github.com/alexcasalboni/aws-lambda-power-tuning) and compare against traditional servers.
- Are there alternatives to laravel/vapor-core for deploying Laravel on AWS Lambda?
- Other options include Bref (PHP runtime for Lambda) or custom Lambda layers for PHP, but they lack Laravel’s deep integration. Vapor-core is the official Laravel solution, offering seamless compatibility with Laravel’s ecosystem (Queues, Redis, Database) and AWS services. For multi-cloud, consider abstracting AWS-specific dependencies (e.g., SQS) using Laravel’s Queue interfaces.
- How does laravel/vapor-core handle background jobs or queues in serverless?
- The package resets scoped instances between Lambda invocations to prevent memory leaks in job queues. Use SQS for queue drivers (e.g., `queue:worker sqs`) and configure Vapor’s queue integrations in `config/queue.php`. For high-volume jobs, monitor SQS metrics in AWS CloudWatch to avoid cost overruns or throttling.
- What are the production concerns when using laravel/vapor-core, like cost or security?
- Serverless pricing (per invocation + duration) can escalate with inefficient code or traffic spikes. Set up AWS Cost Explorer alerts and use provisioned concurrency to reduce cold starts. For security, restrict Lambda execution roles to least privilege and enable AWS WAF for API Gateway endpoints. Use Vapor’s built-in HTTPS and CloudFront for encryption.
- How do I test a Laravel app locally before deploying to Vapor with laravel/vapor-core?
- Use the `VaporRuntime` class to simulate serverless environments locally: `app()->runningOnVapor()` will return `false` in local/dev, so test Lambda-specific logic (e.g., ephemeral storage, execution context) with custom assertions. Mock AWS services using tools like [LocalStack](https://localstack.cloud/) or Laravel’s `Mocker` trait for queues/databases.