PHPackages                             spatie/laravel-dynamic-servers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [DevOps &amp; Deployment](/categories/devops)
4. /
5. spatie/laravel-dynamic-servers

ActiveLibrary[DevOps &amp; Deployment](/categories/devops)

spatie/laravel-dynamic-servers
==============================

Dynamically create and destroy servers

1.1.0(2y ago)23313.0k122MITPHPPHP ^8.2CI passing

Since Aug 27Pushed 1mo ago7 watchersCompare

[ Source](https://github.com/spatie/laravel-dynamic-servers)[ Packagist](https://packagist.org/packages/spatie/laravel-dynamic-servers)[ Docs](https://github.com/spatie/laravel-dynamic-servers)[ RSS](/packages/spatie-laravel-dynamic-servers/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (12)Versions (15)Used By (2)

 [   ![Logo for laravel-dynamic-servers](https://camo.githubusercontent.com/d5a212cbd1471c48a26e2011c518a980de9a47ff75fe6d0c5eca83588fcaf79c/68747470733a2f2f7370617469652e62652f7061636b616765732f6865616465722f6c61726176656c2d64796e616d69632d736572766572732f68746d6c2f6c696768742e77656270)  ](https://spatie.be/open-source?utm_source=github&utm_medium=banner&utm_campaign=laravel-dynamic-servers)Dynamically create and destroy servers
======================================

[](#dynamically-create-and-destroy-servers)

[![Latest Version on Packagist](https://camo.githubusercontent.com/579bd2e748ccc481136cb8c5d1b19985790be0494ea5605efd3831e631ba0524/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7370617469652f6c61726176656c2d64796e616d69632d736572766572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-dynamic-servers)[![GitHub Tests Action Status](https://camo.githubusercontent.com/39f76b6cd9118fecdf58a6ded66074e76292c55cfcc3937f65cc986bf348b340/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d64796e616d69632d736572766572732f72756e2d74657374733f6c6162656c3d7465737473)](https://github.com/spatie/laravel-dynamic-servers/actions?query=workflow%3Arun-tests+branch%3Amain)[![GitHub Code Style Action Status](https://camo.githubusercontent.com/b2dae0bc705c4dbf89df4d36e9c7beddc16c03c461c8183336093d538d039d6b/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f7370617469652f6c61726176656c2d64796e616d69632d736572766572732f466978253230504850253230636f64652532307374796c652532306973737565733f6c6162656c3d636f64652532307374796c65)](https://github.com/spatie/laravel-dynamic-servers/actions?query=workflow%3A%22Fix+PHP+code+style+issues%22+branch%3Amain)[![Total Downloads](https://camo.githubusercontent.com/a219bd35e114a9c19fbea9de8c9eb3980eb29edfa2de252c04cf277da8c872f5/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7370617469652f6c61726176656c2d64796e616d69632d736572766572732e7376673f7374796c653d666c61742d737175617265)](https://packagist.org/packages/spatie/laravel-dynamic-servers)

This package can help you start and stop servers when you need them. The prime use case is to spin up extra working servers that can help you process the workload on queues.

You can think of this as a sort of PHP based version of Kubernetes that has 5% of its features, but covers that 80% use case. For most PHP and Laravel developers, this package will also be easier to learn and use.

Typically, on your hosting provider, you would prepare a server snapshot, that will be used as a template when starting new servers.

After the package is configured, spinning up an extra servers is as easy as:

```
// typically, in a service provider

use Laravel\Horizon\WaitTimeCalculator;
use Spatie\DynamicServers\Facades\DynamicServers;
use Spatie\DynamicServers\Support\DynamicServersManager;

/*
 * The package will call the closure passed
 * to `determineServerCount` every minute
 */
DynamicServers::determineServerCount(function(DynamicServersManager $servers) {
   /*
    * First, we'll calculate the number of servers needed.
    *
    * In this example, we will take a look at Horizon's
    * reported waiting time. Of course, in your project you can
    * calculate the number of servers needed however you want.
    */
    $waitTimeInMinutes = app(WaitTimeCalculator::class)->calculate('default');
    $numberOfServersNeeded = round($waitTimeInMinutes / 10);

   /*
    * Next, we will pass the number of servers needed to the `ensure` method.
    *
    * If there currently are less that that number of servers available,
    * the package will start new ones.
    *
    * If there are currently more than that number of servers running,
    *  the package will stop a few servers.
    */
    $servers->ensure($numberOfServersNeeded);
});
```

Out of the box, the package supports [UpCloud](https://upcloud.com). You can create [your own server provider](https://spatie.be/docs/laravel-dynamic-servers/v1/advanced-usage/creating-your-own-server-provider)to add support for your favourite hosting service.

Support us
----------

[](#support-us)

[![](https://camo.githubusercontent.com/8d54c087abde75ca8db3e4d222cbaa0f87cf37d760f8dc438b1bc9af231401db/68747470733a2f2f6769746875622d6164732e73332e65752d63656e7472616c2d312e616d617a6f6e6177732e636f6d2f6c61726176656c2d64796e616d69632d736572766572732e6a70673f743d31)](https://spatie.be/github-ad-click/laravel-dynamic-servers)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

Documentation
-------------

[](#documentation)

All documentation is available [on our documentation site](https://spatie.be/docs/laravel-dynamic-servers/).

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security Vulnerabilities
------------------------

[](#security-vulnerabilities)

Please review [our security policy](../../security/policy) on how to report security vulnerabilities.

Credits
-------

[](#credits)

- [Rias Van der Veken](https://twitter.com/riasvdv)
- [Freek Van der herten](https://twitter.com/freekmurze)
- [All Contributors](../../contributors)

This idea behind this package was... spawned 🥁 by streams and a blog post by Jason McCreary on [Spawning workers based on queue workload](https://jasonmccreary.me/articles/spawing-worker-servers-job-queue-load-laravel/).

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance61

Regular maintenance activity

Popularity40

Moderate usage in the ecosystem

Community26

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

Top contributor holds 70.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~62 days

Recently: every ~151 days

Total

11

Last Release

733d ago

Major Versions

0.0.7 → 1.0.02022-09-13

PHP version history (2 changes)0.0.1PHP ^8.1

1.1.0PHP ^8.2

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/7535935?v=4)[Spatie](/maintainers/spatie)[@spatie](https://github.com/spatie)

---

Top Contributors

[![freekmurze](https://avatars.githubusercontent.com/u/483853?v=4)](https://github.com/freekmurze "freekmurze (164 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (20 commits)")[![riasvdv](https://avatars.githubusercontent.com/u/3626559?v=4)](https://github.com/riasvdv "riasvdv (19 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (16 commits)")[![xewl](https://avatars.githubusercontent.com/u/245041?v=4)](https://github.com/xewl "xewl (3 commits)")[![jimirobaer](https://avatars.githubusercontent.com/u/8984769?v=4)](https://github.com/jimirobaer "jimirobaer (3 commits)")[![abenerd](https://avatars.githubusercontent.com/u/7523903?v=4)](https://github.com/abenerd "abenerd (2 commits)")[![Nielsvanpach](https://avatars.githubusercontent.com/u/10651054?v=4)](https://github.com/Nielsvanpach "Nielsvanpach (2 commits)")[![AlexVanderbist](https://avatars.githubusercontent.com/u/6287961?v=4)](https://github.com/AlexVanderbist "AlexVanderbist (2 commits)")[![rubenvanerk](https://avatars.githubusercontent.com/u/20305359?v=4)](https://github.com/rubenvanerk "rubenvanerk (1 commits)")[![georgejipa](https://avatars.githubusercontent.com/u/4528530?v=4)](https://github.com/georgejipa "georgejipa (1 commits)")

---

Tags

hostingkuberneteslaravelphpserversspatielaravellaravel-dynamic-servers

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/spatie-laravel-dynamic-servers/health.svg)

```
[![Health](https://phpackages.com/badges/spatie-laravel-dynamic-servers/health.svg)](https://phpackages.com/packages/spatie-laravel-dynamic-servers)
```

###  Alternatives

[spatie/laravel-data

Create unified resources and data transfer objects

1.7k28.9M627](/packages/spatie-laravel-data)[spatie/laravel-horizon-watcher

Automatically restart Horizon when local PHP files change

2631.9M](/packages/spatie-laravel-horizon-watcher)[spatie/laravel-prometheus

Export Laravel metrics to Prometheus

2651.3M6](/packages/spatie-laravel-prometheus)[spatie/laravel-honeypot

Preventing spam submitted through forms

1.6k6.0M60](/packages/spatie-laravel-honeypot)[spatie/laravel-health

Monitor the health of a Laravel application

85810.0M83](/packages/spatie-laravel-health)[spatie/laravel-site-search

A site search engine

300129.1k](/packages/spatie-laravel-site-search)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
