Deploying Laravel Applications with the Vapor CLI
Overview of Serverless Deployments
Deploying a modern web application requires more than just moving files to a server. In a serverless ecosystem like , deployment involves orchestrating resources, asset compilation, and environment configuration. By using a serverless approach, developers move away from managing hardware and toward a model where the infrastructure scales automatically based on demand. This lesson focuses on the mechanics of pushing your local code to a live staging environment using the .
Prerequisites
Before running your first deployment, ensure you have the following in place:
- An active account linked to an account.
- The installed globally via Composer.
- A project already initialized with a
vapor.ymlconfiguration file.
Key Libraries & Tools
- : A serverless deployment platform built specifically for .
- : The command-line interface used to interact with your dashboard and trigger deployments.
- : The underlying cloud provider that hosts the Lambda functions, databases, and assets.
Code Walkthrough: The Deployment Command
Executing a deployment is straightforward but initiates a complex chain of events. Open your terminal in the root of your project and run:
vapor deploy staging
When you execute this command, the performs several critical tasks:
- Asset Preparation: It gathers your CSS and JS assets, often running build scripts to ensure they are production-ready.
- Compression: The tool packages your entire application into a compressed format suitable for .
- Infrastructure Sync: Vapor communicates with to ensure all necessary tags, permissions, and environment variables match your local
vapor.ymlsettings.
You can track this progress in real-time through the terminal or via the web dashboard, which provides a visual timeline of each step's duration and status.
Syntax Notes
The vapor deploy command follows a simple pattern: vapor deploy [environment]. By default, creates staging and production environments. However, you can create custom environments for specific developers or features. If you have a branch for a specific feature, you might run vapor deploy feature-x to isolate those changes.
Practical Examples: Vanity Domains
Every environment created in receives a unique "vanity domain." These are auto-generated URLs (e.g., random-string.vwp.app) that allow you to preview the application immediately after the deployment finishes. This is invaluable for QA testing before pointing a custom production domain to the build.
Tips & Gotchas
- Cold Starts: Initial deployments often take longer because must provision new cloud resources for the first time.
- Environment Parity: Always ensure your local
.envvalues required for production are mirrored in the dashboard orvapor.ymlfile to prevent runtime errors after a successful push.
- 47%· products
- 21%· companies
- 21%· products
- 5%· products
- 5%· products

Learn Laravel Vapor #06: Making a Deployment
WatchLaravel // 2:59
The official YouTube channel of Laravel, the clean stack for Artisans and agents. We will update you on what's new in the world of Laravel, from the framework to our products Cloud, Forge, and Nightwatch.