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

Vapor Cli Laravel Package

laravel/vapor-cli

Laravel Vapor CLI is the command-line client for deploying and managing Laravel apps on Laravel Vapor, a serverless, auto-scaling platform on AWS Lambda. Create and manage infrastructure, environments, queues, databases, Redis, networking, and more.

View on GitHub
Deep Wiki
Context7

Technical Evaluation

Architecture Fit

  • Serverless Laravel Alignment: The laravel/vapor-cli package is optimized for Laravel applications targeting AWS Lambda via Laravel Vapor. It abstracts serverless complexity (e.g., Lambda functions, SQS, DynamoDB, Redis) into a Laravel-centric workflow, making it a natural fit for teams already using Laravel and seeking serverless deployment.
  • AWS-Centric Abstraction: While it hides AWS intricacies, the underlying architecture remains tightly coupled to AWS services (Lambda, API Gateway, CloudFront, etc.). Teams using non-AWS serverless (e.g., Google Cloud Run, Azure Functions) would need to evaluate compatibility or rewrite logic.
  • Monolithic vs. Microservices: Vapor excels for monolithic Laravel apps deployed as serverless functions. For microservices or polyglot architectures, the CLI’s Laravel-specific assumptions (e.g., Artisan commands, Blade templates) may require customization.

Integration Feasibility

  • Laravel Ecosystem: Seamless integration with Laravel’s existing tooling (Artisan, Homestead, Forge). The CLI extends Laravel’s php artisan vapor commands, reducing friction for developers familiar with the framework.
  • AWS SDK Dependency: Relies on the AWS SDK for PHP, which must be installed and configured. Teams without existing AWS SDK experience may face setup overhead.
  • CI/CD Pipeline: Can integrate with GitHub Actions, GitLab CI, or Jenkins via CLI commands (e.g., vapor deploy). Requires AWS credentials (IAM roles or keys) with appropriate Vapor permissions.
  • Database/Storage: Supports DynamoDB, RDS, S3, and ElastiCache, but migrations or schema changes may need manual AWS Console intervention if the CLI lacks full CRUD support.

Technical Risk

  • Cold Starts: Serverless Laravel apps may suffer from Lambda cold starts, impacting performance for high-latency endpoints. Mitigation requires optimizing dependencies (e.g., reducing composer.json bloat) or using Provisioned Concurrency.
  • State Management: Laravel’s session/queue drivers (e.g., Redis, database) must be configured for serverless. Sticky sessions or external cache (e.g., ElastiCache) may be needed to avoid data loss.
  • Debugging Complexity: AWS X-Ray integration is possible but not natively supported in the CLI. Teams may need to manually configure tracing or rely on CloudWatch Logs.
  • Cost Management: Serverless scaling can lead to unexpected AWS bills if not monitored. The CLI lacks built-in cost-alerting; teams must integrate with AWS Cost Explorer or third-party tools.
  • Vendor Lock-in: Heavy reliance on Vapor’s AWS-specific abstractions makes migration to other platforms (e.g., Bref for Symfony) non-trivial.

Key Questions

  1. AWS Maturity: Does the team have existing AWS expertise, or will they need to upskill on Lambda, IAM, and VPC configurations?
  2. Cold Start Tolerance: Can the application handle latency spikes (e.g., <500ms cold starts) without user experience degradation?
  3. Stateful Workloads: Are there sessions, file uploads, or WebSockets that require non-serverless components (e.g., EC2 for WebSockets)?
  4. Multi-Region Needs: Does the app require global deployment? Vapor supports multi-region, but DNS and latency trade-offs must be evaluated.
  5. Custom Logic: Are there Laravel features (e.g., queues, scheduled tasks) that need non-serverless workers (e.g., EC2 or Fargate)?
  6. Compliance: Does the app handle sensitive data requiring AWS KMS encryption or private subnets? The CLI may need custom AWS SDK configurations.
  7. Rollback Strategy: How will deployments be rolled back? Vapor supports rollback, but teams must test failure scenarios (e.g., failed Lambda updates).

Integration Approach

Stack Fit

  • Primary Stack: Laravel (8.x–10.x) + AWS Lambda + API Gateway + Vapor CLI.
  • Secondary Stack:
    • Databases: DynamoDB (serverless) or RDS (provisioned).
    • Caching: ElastiCache (Redis) or DynamoDB Accelerator (DAX).
    • Storage: S3 for files, with optional CloudFront CDN.
    • Queues: SQS or Laravel Queues with DynamoDB.
  • Compatibility:
    • Laravel Packages: Most packages work, but file-system-heavy packages (e.g., caching to storage/) may need S3 adapters.
    • PHP Extensions: AWS SDK requires php-curl, php-openssl, and php-mbstring. Extensions like php-redis are needed for ElastiCache.
    • AWS Services: Vapor CLI assumes AWS account setup (IAM roles, VPC, etc.). Teams must pre-configure:
      • IAM permissions for Vapor (e.g., vapor:Deploy).
      • VPC with NAT Gateway for private subnets (if using RDS/ElastiCache).
      • Route 53 for custom domains.

Migration Path

  1. Pre-Migration:
    • Audit Laravel app for non-serverless dependencies (e.g., storage/framework/ writes, queue workers).
    • Configure AWS account with Vapor IAM roles and VPC.
    • Set up CI/CD pipeline with vapor-cli (e.g., GitHub Actions workflow for vapor deploy).
  2. Pilot Deployment:
    • Deploy a non-critical Laravel endpoint (e.g., API route) to Vapor via CLI.
    • Test cold starts, database connections, and file uploads.
  3. Phased Rollout:
    • Migrate read-heavy routes first (lower cold-start impact).
    • Gradually shift write operations (e.g., queues, jobs) to serverless-compatible drivers.
  4. Post-Migration:
    • Optimize Lambda memory/timeout settings via vapor config.
    • Set up AWS CloudWatch Alarms for errors/throttles.
    • Implement feature flags for gradual traffic shifting.

Compatibility

  • Laravel Features:
    • Blade Templates: Supported (compiled to Lambda).
    • Artisan Commands: Limited (only CLI-accessible commands work; web-based Artisan may fail).
    • Queues: SQS/DynamoDB supported; database queues require RDS.
    • ⚠️ Scheduling: Laravel’s task scheduler may need external cron (e.g., EC2 or EventBridge).
    • Broadcasting: WebSockets require Pusher or custom setup (not natively serverless).
  • AWS Services:
    • API Gateway: Auto-configured for REST/WebSocket APIs.
    • CloudFront: CDN integration via CLI.
    • ⚠️ RDS/ElastiCache: Requires VPC and security group configuration.
    • EC2/ECS: Not supported; use Lambda for all compute.

Sequencing

  1. Infrastructure Setup:
    • Configure AWS account, IAM roles, and VPC.
    • Install vapor-cli globally (composer global require laravel/vapor-cli).
  2. Laravel Preparation:
    • Update composer.json to exclude heavy dependencies (e.g., dev-only packages).
    • Configure vapor.yml for environment-specific settings (e.g., DynamoDB tables).
  3. Local Testing:
    • Use vapor test to validate Lambda compatibility.
    • Mock AWS services locally with LocalStack or SAM CLI.
  4. Deployment:
    • Run vapor deploy production in CI/CD.
    • Verify with vapor logs and CloudWatch.
  5. Monitoring:
    • Set up X-Ray tracing (if needed) and Synthetic Transactions for uptime checks.

Operational Impact

Maintenance

  • Proactive:
    • Dependency Management: Regularly update laravel/vapor-cli and AWS SDK to patch vulnerabilities.
    • Lambda Layers: Use shared layers (e.g., PHP extensions) to reduce deployment size.
    • Configuration Drift: Monitor vapor.yml for manual changes; enforce IaC (e.g., Terraform) for critical AWS resources.
  • Reactive:
    • Rollbacks: Use vapor rollback for failed deployments. Test rollback procedures for critical paths.
    • Patch Management: AWS services (e.g., PHP runtime) are patched automatically; Laravel core must be manually updated.

Support

  • Troubleshooting:
    • Logs: Centralize Lambda logs in CloudWatch with vapor logs --tail.
    • Debugging: Use vapor ssh (if enabled) for interactive debugging or AWS X-Ray for tracing.
    • Common Issues:
      • Timeout Errors: Increase Lambda timeout in vapor.yml.
      • Permission Denied: Verify IAM roles for Vapor service.
      • **Cold St
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.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport