PHPackages                             dacheng-php/yii2-swoole - 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. dacheng-php/yii2-swoole

ActiveYii2-extension[Framework](/categories/framework)

dacheng-php/yii2-swoole
=======================

Yii2 Swoole extension, provides coroutine http server and more coroutine features.

v0.2(6mo ago)2331↓50%3[19 issues](https://github.com/dacheng-php/yii2-swoole/issues)[1 PRs](https://github.com/dacheng-php/yii2-swoole/pulls)MITPHPPHP &gt;=8.1

Since Oct 24Pushed 4mo ago2 watchersCompare

[ Source](https://github.com/dacheng-php/yii2-swoole)[ Packagist](https://packagist.org/packages/dacheng-php/yii2-swoole)[ RSS](/packages/dacheng-php-yii2-swoole/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (6)Versions (3)Used By (0)

Yii2-Swoole
===========

[](#yii2-swoole)

Yii2 extension for Swoole: High-performance single-process asynchronous HTTP server with coroutines, database/Redis connection pools, and async job queue for building high-concurrency PHP applications.

✨ Features
----------

[](#-features)

### 🚀 Core Features

[](#-core-features)

- **Single-Process Coroutine HTTP Server** - No process management overhead
- **Automatic Connection Pooling** - MySQL and Redis connection reuse
- **Async Job Queue** - Redis-based queue with concurrent processing
- **Non-blocking Logging** - Async file logging with channel buffering
- **Coroutine HTTP Client** - Non-blocking HTTP requests with parallel execution
- **Coroutine Components** - Session, User, DB, Redis, Cache all coroutine-safe
- **Graceful Shutdown** - Clean shutdown of pools, workers, and connections
- **Static File Serving** - Built-in support for CSS, JS, images, fonts

### ⚡ Performance Benefits

[](#-performance-benefits)

- **10-100x faster** than traditional PHP-FPM for I/O bound workloads
- **Persistent connections** - Database and Redis connections stay open
- **Zero copy** - Direct memory operations where possible
- **Concurrent processing** - Handle thousands of requests simultaneously

### 🛠️ Developer Experience

[](#️-developer-experience)

- **Drop-in replacement** - Minimal code changes from standard Yii2
- **Full Yii2 compatibility** - Works with existing Yii2 components
- **Easy configuration** - Simple bootstrap and component setup
- **Rich examples** - Complete example applications included

📋 Requirements
--------------

[](#-requirements)

- PHP &gt;= 8.1
- Swoole &gt;= 6.0
- Yii2 &gt;= 2.0

📦 Installation
--------------

[](#-installation)

```
composer require dacheng-php/yii2-swoole
```

🚀 Quick Start
-------------

[](#-quick-start)

### 1. Create Configuration

[](#1-create-configuration)

Create `config/swoole.php`:

```
