{"id":19324913,"url":"https://github.com/spatie/laravel-dynamic-servers","last_synced_at":"2025-05-15T14:02:10.252Z","repository":{"id":57969948,"uuid":"529282966","full_name":"spatie/laravel-dynamic-servers","owner":"spatie","description":"Dynamically create and destroy servers","archived":false,"fork":false,"pushed_at":"2025-05-12T19:57:05.000Z","size":253,"stargazers_count":227,"open_issues_count":0,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-05-12T20:53:22.516Z","etag":null,"topics":["hosting","kubernetes","laravel","php","servers"],"latest_commit_sha":null,"homepage":"https://spatie.be/docs/laravel-dynamic-servers/","language":"PHP","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spatie.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"docs/support-us.md","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-08-26T14:08:58.000Z","updated_at":"2025-05-12T19:57:03.000Z","dependencies_parsed_at":"2024-01-08T20:29:00.200Z","dependency_job_id":"3ece1e10-bde4-41ba-9c2a-a9f4af62a44e","html_url":"https://github.com/spatie/laravel-dynamic-servers","commit_stats":{"total_commits":144,"total_committers":10,"mean_commits":14.4,"dds":0.4444444444444444,"last_synced_commit":"d20fcb73d0b85c4f188c9e960a75908709dc44b7"},"previous_names":[],"tags_count":11,"template":false,"template_full_name":"spatie/package-skeleton-laravel","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-dynamic-servers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-dynamic-servers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-dynamic-servers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spatie%2Flaravel-dynamic-servers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spatie","download_url":"https://codeload.github.com/spatie/laravel-dynamic-servers/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823353,"owners_count":21969844,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hosting","kubernetes","laravel","php","servers"],"created_at":"2024-11-10T02:07:29.973Z","updated_at":"2025-05-15T14:02:10.206Z","avatar_url":"https://github.com/spatie.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"left\"\u003e\n    \u003ca href=\"https://spatie.be/open-source?utm_source=github\u0026utm_medium=banner\u0026utm_campaign=laravel-dynamic-servers\"\u003e\n      \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://spatie.be/packages/header/laravel-dynamic-servers/html/dark.webp\"\u003e\n        \u003cimg alt=\"Logo for laravel-dynamic-servers\" src=\"https://spatie.be/packages/header/laravel-dynamic-servers/html/light.webp\" height=\"190\"\u003e\n      \u003c/picture\u003e\n    \u003c/a\u003e\n\n\u003ch1\u003eDynamically create and destroy servers\u003c/h1\u003e\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/spatie/laravel-dynamic-servers.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-dynamic-servers)\n[![GitHub Tests Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-dynamic-servers/run-tests?label=tests)](https://github.com/spatie/laravel-dynamic-servers/actions?query=workflow%3Arun-tests+branch%3Amain)\n[![GitHub Code Style Action Status](https://img.shields.io/github/workflow/status/spatie/laravel-dynamic-servers/Fix%20PHP%20code%20style%20issues?label=code%20style)](https://github.com/spatie/laravel-dynamic-servers/actions?query=workflow%3A\"Fix+PHP+code+style+issues\"+branch%3Amain)\n[![Total Downloads](https://img.shields.io/packagist/dt/spatie/laravel-dynamic-servers.svg?style=flat-square)](https://packagist.org/packages/spatie/laravel-dynamic-servers)\n    \n\u003c/div\u003e\n\nThis 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.\n\nYou 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.\n\nTypically, on your hosting provider, you would prepare a server snapshot, that will be used as a template when starting\nnew servers.\n\nAfter the package is configured, spinning up an extra servers is as easy as:\n\n```php\n// typically, in a service provider\n\nuse Laravel\\Horizon\\WaitTimeCalculator;\nuse Spatie\\DynamicServers\\Facades\\DynamicServers;\nuse Spatie\\DynamicServers\\Support\\DynamicServersManager;\n\n/*\n * The package will call the closure passed \n * to `determineServerCount` every minute\n */\nDynamicServers::determineServerCount(function(DynamicServersManager $servers) {\n   /*\n    * First, we'll calculate the number of servers needed. \n    * \n    * In this example, we will take a look at Horizon's \n    * reported waiting time. Of course, in your project you can \n    * calculate the number of servers needed however you want.    \n    */\n    $waitTimeInMinutes = app(WaitTimeCalculator::class)-\u003ecalculate('default');\n    $numberOfServersNeeded = round($waitTimeInMinutes / 10);\n\n   /*\n    * Next, we will pass the number of servers needed to the `ensure` method.\n    * \n    * If there currently are less that that number of servers available,\n    * the package will start new ones.\n    * \n    * If there are currently more than that number of servers running,\n    *  the package will stop a few servers.\n    */\n    $servers-\u003eensure($numberOfServersNeeded);\n});\n```\n\nOut of the box, the package supports [UpCloud](https://upcloud.com). You can\ncreate [your own server provider](https://spatie.be/docs/laravel-dynamic-servers/v1/advanced-usage/creating-your-own-server-provider)\nto add support for your favourite hosting service.\n\n## Support us\n\n[\u003cimg src=\"https://github-ads.s3.eu-central-1.amazonaws.com/laravel-dynamic-servers.jpg?t=1\" width=\"419px\" /\u003e](https://spatie.be/github-ad-click/laravel-dynamic-servers)\n\nWe invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can\nsupport us by [buying one of our paid products](https://spatie.be/open-source/support-us).\n\nWe highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.\nYou'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards\non [our virtual postcard wall](https://spatie.be/open-source/postcards).\n\n## Documentation\n\nAll documentation is available [on our documentation site](https://spatie.be/docs/laravel-dynamic-servers/).\n\n## Testing\n\n```bash\ncomposer test\n```\n\n## Changelog\n\nPlease see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Security Vulnerabilities\n\nPlease review [our security policy](../../security/policy) on how to report security vulnerabilities.\n\n## Credits\n\n- [Rias Van der Veken](https://twitter.com/riasvdv)\n- [Freek Van der herten](https://twitter.com/freekmurze)\n- [All Contributors](../../contributors)\n\nThis 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/).\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-dynamic-servers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspatie%2Flaravel-dynamic-servers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspatie%2Flaravel-dynamic-servers/lists"}