Introduction
Previously, I had the main branch running as production in a Laravel Cloud environment.
Continuing from that setup, suppose there is a branch called feature/locale-switcher in the same repository that adds language-switching functionality. In this case, it is possible to quickly add feature/locale-switcher as a separate deployment environment alongside the main branch. Let's walk through this demonstration.
Creating a New Environment
Laravel Cloud supports running multiple branches in parallel. Here, we'll create a New Environment for react-starter-kit-i18n.
You can then select the branch you want to deploy.
An environment independent from main is created as shown below. Before deploying, click Settings to configure it first.
As before, the most important settings will likely be under General and Deployments. We'll focus on configuring those.
You'll probably need to add most of these environment variable settings
After configuring them, deploy the environment.
Deployment starts in a completely separate space from main (production).
Once deployment is complete, use the Commands tab as needed to run artisan commands and finalize the setup.
Issued URL and Verification
After everything is set up, Laravel Cloud issues the URL:
https://react-starter-kit-i18n-feature-locale-switcher-w9x8ho.laravel.cloud/
This URL is different from the production URL.
- Japanese version: https://react-starter-kit-i18n-production-sbhkku.laravel.cloud/
- Locale Switcher version: https://react-starter-kit-i18n-feature-locale-switcher-w9x8ho.laravel.cloud/
Verification
Let's access https://react-starter-kit-i18n-feature-locale-switcher-w9x8ho.laravel.cloud/ and verify that it is actually running.
This time, the welcome page is in English
This Locale Switcher branch allows users to change the language from the login screen or later in the application. Let's open the login page. You can see a language selector that did not exist in the previous branch.
Example after switching to French
You can log in with:
- test@example.com
- password
After logging in, I switched the interface to German.
Switching to German
Summary
In this article, we reviewed how to create an additional environment for an existing application in Laravel Cloud and deploy a different branch in parallel.
In this example, we published the feature/locale-switcher branch on its own URL, separate from the main branch, and successfully verified the language-switching functionality.
The primary advantage of this feature is that new functionality can be tested on an actual server before being merged into production. It is useful not only for developers' own verification but also for sharing URLs with clients or team members for review.
Traditionally, a separate server or container would need to be prepared to build a testing environment. With Laravel Cloud, however, an isolated environment can be created in just a few clicks, making it much easier to validate new features or design changes.
For individual developers and small teams in particular, the ability to quickly create an environment simply to "let someone take a look" can be a significant benefit.










Top comments (0)