Laravel Cloud Preview Environments &amp; Scale to Zero | Mohamed Said       [Skip to content](#main)  [ ![](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png) Mohamed SaidLaravel Backend Engineer ](https://www.msaied.com/public) - [Home](https://www.msaied.com/public)
- [Projects](https://www.msaied.com/public/projects)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [About](https://www.msaied.com/public#about)

           [  Contact](https://www.msaied.com/public#contact) Menu 

Menu
----

Close 

 - [HomeStart here](https://www.msaied.com/public)
- [ProjectsCase studies](https://www.msaied.com/public/projects)
- [ArticlesEngineering notes](https://www.msaied.com/public/articles)
- [CertificatesCredentials](https://www.msaied.com/public/certificates)
- [AboutHow I work](https://www.msaied.com/public#about)
- [ContactGet in touch](https://www.msaied.com/public#contact)

  [Start a conversation](https://www.msaied.com/public#contact) [WhatsApp](https://wa.me/201094619204) [Email](mailto:hello@msaied.com) 

 1. [Home](https://www.msaied.com/public)
2. /
3. [Articles](https://www.msaied.com/public/articles)
4. /
5. [Laravel](https://www.msaied.com/public/articles?category=laravel)
6. /
7. Preview Environments and Scale to Zero on Laravel Cloud: Better Together

   [Laravel](https://www.msaied.com/public/articles?category=laravel) 

 Preview Environments and Scale to Zero on Laravel Cloud: Better Together
=========================================================================

 Laravel Cloud preview environments give every pull request its own live URL. Pair them with scale to zero and idle previews cost cents, not dollars—making full-stack PR reviews practical for any team.

 ![](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp) [Mohamed Said](https://www.msaied.com/public#person) Published 28 Sep 2026 · Updated 28 Sep 2026 · 4 min read

ShareCopy linkCopied

 ![Preview Environments and Scale to Zero on Laravel Cloud: Better Together](https://cdn.msaied.com/714/64d9ff6237e2f6260fc4bcebb274edfa.png) 

  On this page +1. [The Problem: "Can I Try It?"](#the-problem-quotcan-i-try-itquot)
2. [A Working Application in Every Pull Request](#a-working-application-in-every-pull-request)
3. [Let Idle Previews Sleep with Scale to Zero](#let-idle-previews-sleep-with-scale-to-zero)
4. [Test Closer to Production](#test-closer-to-production)
5. [Give Experiments Their Own Space](#give-experiments-their-own-space)
6. [A Representative Stack, Isolated by Default](#a-representative-stack-isolated-by-default)
7. [Key Takeaways](#key-takeaways)

 The Problem: "Can I Try It?"
----------------------------

Code is ready, tests pass, and then someone asks: *"Can I try it?"* Staging is occupied, the reviewer can't run the project locally, and a screen recording just isn't the same as clicking through the real thing.

Laravel Cloud's **preview environments** solve this with a single answer: here's a link.

A Working Application in Every Pull Request
-------------------------------------------

Once you configure an automation under **Settings → Preview environments**, opening a pull request against your target branch automatically:

- Provisions a dedicated environment with a unique URL
- Posts that URL directly to the pull request
- Redeploys on every new commit
- Cleans up resources when the PR is merged or closed

The place where you discuss a change also contains a working version of it. A designer can review the interaction, a client can confirm the feature meets their need, and a QA engineer can run through the full flow—all without touching staging.

Let Idle Previews Sleep with Scale to Zero
------------------------------------------

The obvious concern is cost. A preview might need application compute, a database, a cache, and background workers. Multiply that across several open pull requests and it sounds expensive.

In practice, previews spend most of their time waiting. A reviewer spends 15 minutes on a change, leaves a comment, and moves on. The developer picks it up after lunch. [Scale to zero](https://laravel.com/cloud/docs/compute#scale-to-zero) is a perfect match for this pattern—resources sleep when idle and wake on demand.

The numbers from the official announcement illustrate just how affordable this is:

| Preview branch | Active lifetime | Estimated cost (USD) | |-------------------|-----------------|----------------------| | feature/checkout | 10 minutes | ≈ $0.0033 | | feature/account | 1 hour 30 min | ≈ $0.0298 | | feature/emails | 2 hours 20 min | ≈ $0.0463 | | **Total** | **4 hours** | **≈ $0.08** |

Laravel Cloud's preview defaults enable scale to zero wherever it is supported, so you get isolation without paying for idle time.

Test Closer to Production
-------------------------

A preview is a real deployment, not a mock. That means you can:

- Run browser tests (e.g., Laravel Dusk) against the preview URL
- Exercise third-party integrations with sandbox credentials
- Verify that build and deployment commands produce the expected result
- Catch configuration mistakes before they reach production

Requests travel over the public internet and your application talks to actual services—giving you a much more representative signal than a local environment.

Give Experiments Their Own Space
--------------------------------

Previews are also useful for exploring changes you haven't committed to yet. Want to evaluate [managed queues](https://laravel.com/blog/managed-queues-autoscaling-queue-workers-on-laravel-cloud)? Add the service to a preview, run representative jobs, inspect failures, and get comfortable with the configuration—all without touching production.

Because each preview is isolated, you can adjust its resources independently and answer practical questions with a running application.

A Representative Stack, Isolated by Default
-------------------------------------------

Preview environments are designed to mirror production resource types while remaining completely separate:

- **Dedicated database, cache, and queue** per preview
- **Independent environment variables** so production secrets stay out of previews
- **Scale to zero** enabled by default to keep costs minimal
- Option to share existing resources when appropriate (though keeping production databases separate is strongly recommended)

Key Takeaways
-------------

- Configure automations under **Settings → Preview environments** on your target environment.
- Each PR gets a unique URL, auto-updated on new commits, and cleaned up on merge/close.
- Scale to zero means an entire sprint's worth of open PRs can cost less than a dollar in compute.
- Previews support browser testing, integration testing, and safe experimentation with new services.
- Environment variables are scoped per automation, keeping production secrets isolated.

---

*Source: [Preview environments and scale to zero: Better together](https://laravel.com/blog/preview-environments-and-scale-to-zero-better-together) — Laravel Blog, Sep 28, 2026*

- [Laravel Cloud](https://www.msaied.com/public/articles?search=Laravel%20Cloud)
- [Preview Environments](https://www.msaied.com/public/articles?search=Preview%20Environments)
- [Scale to Zero](https://www.msaied.com/public/articles?search=Scale%20to%20Zero)
- [CI/CD](https://www.msaied.com/public/articles?search=CI%2FCD)
- [Pull Requests](https://www.msaied.com/public/articles?search=Pull%20Requests)
- [Deployment](https://www.msaied.com/public/articles?search=Deployment)

 Frequently asked questions 
---------------------------

  How much does a Laravel Cloud preview environment cost with scale to zero enabled?Very little. According to Laravel's own figures, three feature branches with a combined active lifetime of about four hours cost approximately $0.08 in total compute. Resources sleep when idle and only incur cost when actively serving traffic.

   Are preview environment databases isolated from production?Yes. By default, Laravel Cloud provisions dedicated resources—including databases and caches—for each preview environment. Laravel strongly recommends keeping production databases separate from previews to avoid affecting real data or triggering real actions.

   How do I set up preview environments on Laravel Cloud?Navigate to Settings → Preview environments on the environment you want to generate previews from. Create an automation, define your branch rules and resource settings, add required environment variables, and configure deployment and cleanup behavior. The official documentation covers all available options.

   ![Mohamed Said](https://cdn.msaied.com/01M22N44A70A5MC2S599JP0MPH.webp)About the author
----------------

[Mohamed Said](https://www.msaied.com/public#person)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

[About](https://www.msaied.com/public#about) [GitHub ↗](https://github.com/EG-Mohamed) [LinkedIn ↗](https://www.linkedin.com/in/msaiedm/) [WhatsApp ↗](https://wa.me/201094619204) [Email Address ↗](mailto:hello@msaied.com) [My CV ↗](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)  

   [Previous articleProfiling Laravel with Blackfire and Xdebug: Finding Real Bottlenecks](https://www.msaied.com/public/articles/profiling-laravel-with-blackfire-and-xdebug-finding-real-bottlenecks-2) [Next articleUnlearn.dev Goes Free for a Weekend: October 10 and 11](https://www.msaied.com/public/articles/unlearndev-goes-free-for-a-weekend-october-10-and-11)  

   On this page
-------------

1. [The Problem: "Can I Try It?"](#the-problem-quotcan-i-try-itquot)
2. [A Working Application in Every Pull Request](#a-working-application-in-every-pull-request)
3. [Let Idle Previews Sleep with Scale to Zero](#let-idle-previews-sleep-with-scale-to-zero)
4. [Test Closer to Production](#test-closer-to-production)
5. [Give Experiments Their Own Space](#give-experiments-their-own-space)
6. [A Representative Stack, Isolated by Default](#a-representative-stack-isolated-by-default)
7. [Key Takeaways](#key-takeaways)

 ###  Have a technical challenge?

 Tell me what you’re building. I reply within two working days.

[Start a conversation](https://www.msaied.com/public#contact) 

   Related articles
-----------------

 [ ![](https://cdn.msaied.com/740/cce86edc21eddcbdd2f2454fadaf9c70.png)  · 3 min read### The Pipeline Pattern in Laravel: Custom Pipelines Beyond Middleware

5 Oct 2026 ](https://www.msaied.com/public/articles/the-pipeline-pattern-in-laravel-custom-pipelines-beyond-middleware-1) [ ![](https://cdn.msaied.com/739/2d6897fdcdcf090613f96f72a64b8a78.png)  · 4 min read### MySQL Full-Text Search in Laravel: Indexes, Relevance Scoring, and Boolean Mode

4 Oct 2026 ](https://www.msaied.com/public/articles/mysql-full-text-search-in-laravel-indexes-relevance-scoring-and-boolean-mode) [ ![](https://cdn.msaied.com/738/073696a3fefe18bec825beec5ac658f5.png)  · 4 min read### Laravel Queue Rate-Limited Middleware: Throttling Jobs Without Losing Work

4 Oct 2026 ](https://www.msaied.com/public/articles/laravel-queue-rate-limited-middleware-throttling-jobs-without-losing-work) 

  Have a technical challenge?
----------------------------

Tell me what you’re building. I reply within two working days.

 [Discuss your project ↗](https://www.msaied.com/public#contact) 

  © 2026 Mohamed Said · Built with Laravel, meant to last.Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

 - [Home](https://www.msaied.com/public)
- [Articles](https://www.msaied.com/public/articles)
- [Certificates](https://www.msaied.com/public/certificates)
- [GitHub](https://github.com/EG-Mohamed)
- [LinkedIn](https://www.linkedin.com/in/msaiedm/)
- [WhatsApp](https://wa.me/201094619204)
- [Email Address](mailto:hello@msaied.com)
- [My CV](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
- [Sitemap](https://www.msaied.com/public/sitemap.xml)
