PHPackages                             valkyrja/openswoole - 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. [Framework](/categories/framework)
4. /
5. valkyrja/openswoole

ActiveLibrary[Framework](/categories/framework)

valkyrja/openswoole
===================

OpenSwoole persistent worker entry point for the Valkyrja Framework.

26.x-dev(1w ago)00MITPHPPHP &gt;=8.4CI passing

Since Apr 17Pushed 1w agoCompare

[ Source](https://github.com/valkyrjaio/valkyrja-openswoole-php)[ Packagist](https://packagist.org/packages/valkyrja/openswoole)[ Docs](https://www.valkyrja.io)[ RSS](/packages/valkyrja-openswoole/feed)WikiDiscussions 26.x Synced 1w ago

READMEChangelogDependencies (2)Versions (13)Used By (0)

[ ![](https://raw.githubusercontent.com/valkyrjaio/art/refs/heads/master/long-banner/orange/php.png)](https://valkyrja.io)

Valkyrja OpenSwoole
===================

[](#valkyrja-openswoole)

OpenSwoole persistent worker entry point for the [Valkyrja](https://valkyrja.io)PHP framework.

This integration bootstraps the Valkyrja application once at worker startup, then dispatches every incoming request to an isolated child container so request state never bleeds between concurrent requests. The result is the performance benefit of a persistent process without the state-contamination risks of naive long-running PHP.

 [![PHP Version Require](https://camo.githubusercontent.com/3e5f335b1c3a6c226bc926a716cac2f851322ed1c02c05b484bbc35afecfec22/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f6f70656e73776f6f6c652f726571756972652f706870)](https://packagist.org/packages/valkyrja/openswoole) [![Latest Stable Version](https://camo.githubusercontent.com/f8a3d81efd5bbf9fa3b29edd8ad2a596b3bc8979e7f41616e0340078422a107a/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f6f70656e73776f6f6c652f76)](https://packagist.org/packages/valkyrja/openswoole) [![License](https://camo.githubusercontent.com/97b82cc828a38ed56a0ee759496c5a9fd8a79f447e5f51391e69c9c233df1afa/68747470733a2f2f706f7365722e707567782e6f72672f76616c6b79726a612f6f70656e73776f6f6c652f6c6963656e7365)](https://packagist.org/packages/valkyrja/openswoole) [![CI Status](https://github.com/valkyrjaio/valkyrja-openswoole-php/actions/workflows/ci.yml/badge.svg?branch=26.x)](https://github.com/valkyrjaio/valkyrja-openswoole-php/actions/workflows/ci.yml?query=branch%3A26.x) [![Scrutinizer](https://camo.githubusercontent.com/0f6b1045565ddcf445c3a34184319a08784271c23a4a949ef0026dc5178f5431/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f76616c6b79726a61696f2f76616c6b79726a612d6f70656e73776f6f6c652d7068702f6261646765732f7175616c6974792d73636f72652e706e673f623d32362e78)](https://scrutinizer-ci.com/g/valkyrjaio/valkyrja-openswoole-php/?branch=26.x) [![Coverage Status](https://camo.githubusercontent.com/1934946bfaae035f3f87cae210f800d5d267248f97180a9c2b3d0148264ad031/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f76616c6b79726a61696f2f76616c6b79726a612d6f70656e73776f6f6c652d7068702f62616467652e7376673f6272616e63683d32362e78)](https://coveralls.io/github/valkyrjaio/valkyrja-openswoole-php?branch=26.x) [![Psalm Shepherd](https://camo.githubusercontent.com/27d8d4d62b78791d29dc87ce577e974c73eb7db86c2b445f11edcd8bed6db2ef/68747470733a2f2f73686570686572642e6465762f6769746875622f76616c6b79726a61696f2f76616c6b79726a612d6f70656e73776f6f6c652d7068702f636f7665726167652e737667)](https://shepherd.dev/github/valkyrjaio/valkyrja-openswoole-php) [![Maintainability Rating](https://camo.githubusercontent.com/c626915abd1d71e9e0f8cd7eac9fbb67d1af307c4930276e2fef90b1f0c9b88d/68747470733a2f2f736f6e6172636c6f75642e696f2f6170692f70726f6a6563745f6261646765732f6d6561737572653f70726f6a6563743d76616c6b79726a61696f5f6f70656e73776f6f6c65266d65747269633d7371616c655f726174696e67)](https://sonarcloud.io/summary/new_code?id=valkyrjaio_openswoole)

Requirements
------------

[](#requirements)

- PHP 8.4+
- The [OpenSwoole](https://openswoole.com/) PHP extension (`openswoole/core ^26.2.0`)
- An existing [Valkyrja](https://github.com/valkyrjaio/valkyrja-php) application

Installation
------------

[](#installation)

```
composer require valkyrja/openswoole

```

Usage
-----

[](#usage)

Wire the OpenSwoole entry point into your application's front controller:

```
// app/public/index.php
use Valkyrja\Application\Data\HttpConfig;
use Valkyrja\OpenSwoole\OpenSwooleHttp;

OpenSwooleHttp::run(new HttpConfig(
    dir: __DIR__ . '/..',
));

```

`run()` bootstraps the application once when the worker process starts, then starts the OpenSwoole HTTP server. Each request is handled in an isolated child container so state never bleeds between requests.

### Customizing the Server

[](#customizing-the-server)

Override `getSwooleServer()` to configure the server address, port, or options:

```
use OpenSwoole\HTTP\Server;
use Valkyrja\OpenSwoole\OpenSwooleHttp;

class App extends OpenSwooleHttp
{
    public static function getSwooleServer(): Server
    {
        $server = new Server('0.0.0.0', 8080);
        $server->set([
            'worker_num'  => 4,
            'max_request' => 10000,
        ]);

        return $server;
    }
}

```

### Customizing Bootstrap

[](#customizing-bootstrap)

Override `bootstrapParentServices()` to force-resolve services that are expensive to create and safe to share across requests:

```
use Valkyrja\Application\Kernel\Contract\ApplicationContract;
use Valkyrja\Http\Routing\Collection\Contract\CollectionContract;
use Valkyrja\OpenSwoole\OpenSwooleHttp;

class App extends OpenSwooleHttp
{
    protected static function bootstrapParentServices(ApplicationContract $app): void
    {
        $container = $app->getContainer();
        $container->getSingleton(CollectionContract::class);
        $container->getSingleton(MyExpensiveSharedService::class);
    }
}

```

Worker Lifecycle
----------------

[](#worker-lifecycle)

See the [Valkyrja framework repository](https://github.com/valkyrjaio/valkyrja-php) for a full explanation of the persistent worker lifecycle, the child container isolation model, and configuration options.

Related Integrations
--------------------

[](#related-integrations)

Other persistent-worker runtime integrations for Valkyrja PHP:

- [**FrankenPHP**](https://github.com/valkyrjaio/valkyrja-frankenphp-php) — persistent worker via the FrankenPHP embedded runtime
- [**RoadRunner**](https://github.com/valkyrjaio/valkyrja-roadrunner-php) — persistent worker via the Go-based RoadRunner manager

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

[](#contributing)

See [`CONTRIBUTING.md`](https://github.com/valkyrjaio/.github/blob/master/CONTRIBUTING.md) for the submission process and [`VOCABULARY.md`](https://github.com/valkyrjaio/.github/blob/master/VOCABULARY.md) for the terminology used across Valkyrja.

Security Issues
---------------

[](#security-issues)

If you discover a security vulnerability, please follow our [disclosure procedure](https://github.com/valkyrjaio/.github/blob/master/SECURITY.md).

License
-------

[](#license)

Licensed under the [MIT license](https://opensource.org/licenses/MIT). See [`LICENSE.md`](./LICENSE.md).

###  Health Score

39

—

LowBetter than 84% of packages

Maintenance98

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity44

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 75.9% 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

Unknown

Total

1

Last Release

8d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/fbb43a59fb790365b014e53f82e3f26893867e4a47a249fc92962b6dc76878f2?d=identicon)[MelechMizrachi](/maintainers/MelechMizrachi)

---

Top Contributors

[![valkyrja-volundr[bot]](https://avatars.githubusercontent.com/in/2462900?v=4)](https://github.com/valkyrja-volundr[bot] "valkyrja-volundr[bot] (60 commits)")[![MelechMizrachi](https://avatars.githubusercontent.com/u/1179171?v=4)](https://github.com/MelechMizrachi "MelechMizrachi (19 commits)")

---

Tags

frameworkswooleworkeropenswoolevalkyrja

### Embed Badge

![Health badge](/badges/valkyrja-openswoole/health.svg)

```
[![Health](https://phpackages.com/badges/valkyrja-openswoole/health.svg)](https://phpackages.com/packages/valkyrja-openswoole)
```

###  Alternatives

[easyswoole/orm

php stander lib

3090.3k25](/packages/easyswoole-orm)[siam/easyswoole-http-monitor

easyswoole的HTTP请求监控、复发

422.9k](/packages/siam-easyswoole-http-monitor)[mzh/hyperf-validate

hyperf-validate 支持request 和方法场景验证，兼容tp5写法 支持控制器注解验证、方法注解验证

192.9k1](/packages/mzh-hyperf-validate)

PHPackages © 2026

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