# Hyperf: Coroutine PHP Framework for High-Concurrency Services

> A PHP framework that trades traditional request-per-process for coroutines and runs on Swoole or Swow. Emphasizes flexibility through AOP and dependency injection; designed for microservices and real-time applications.

**hyperf/hyperf** — 🚀 A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.

- Repository: https://github.com/hyperf/hyperf
- Website: https://www.hyperf.io
- Stars: 6,905 · Forks: 1,295
- Language: PHP
- License: MIT
- Published: 2026-09-22 · Updated: 2026-09-22 · Language: en
- Canonical page: https://hysenlabs.com/projects/hyperf-hyperf

## Coroutines as the alternative to PHP-FPM

Hyperf replaces the traditional PHP-FPM model (one process per request) with Swoole or Swow coroutines, which handle thousands of concurrent requests in a single process. According to the README, the framework is built on coroutines, dependency injection, events, annotations, and AOP. A benchmark in the README shows 103,000 requests per second on an 8-core 16 GB Aliyun machine using wrk with 1024 connections. This is not a claim but a measured result from the README. For teams whose application sits behind a load balancer and handles bursty traffic or long-lived connections (WebSocket, real-time updates), the concurrency model is a fit. For simple CRUD endpoints served by a managed database, the operational complexity may not justify the performance gain.

## AOP and dependency injection for composable code

Hyperf bundles an AOP-enabling dependency injector. According to the README, components and classes are all pluggable and meta-programmable via the Hyperf DI container. This design choice means you can decorate methods with behavior (logging, caching, rate limiting) without editing the method body. Aspect-oriented programming can reduce boilerplate when used disciplined; it can also obscure control flow if overused. Hyperf's commitment to PSR standards means components are shareable; you can use Hyperf's AMQP, HTTP client, or database libraries in other frameworks.

## Built-in components for distributed systems

Hyperf ships with coroutine clients for common infrastructure: MySQL, Redis, WebSocket (server and client), JSON-RPC, gRPC, Elasticsearch, Consul, ETCD, AMQP, Zipkin/Jaeger tracing, and others. According to the README, developers can entirely avoid implementing coroutine-compatible versions of these libraries. A token bucket rate limiter and circuit breaker are included. Configuration center support includes Apollo, Aliyun ACM, and ETCD. Message queue support covers RabbitMQ, NSQ, and NATS. The framework also provides a Guzzle HTTP client, Snowflake for distributed IDs, and Simply Redis MQ for task distribution. No need to manually wire a gRPC or message queue connection; declare the service and Hyperf provides the coroutine-safe client. This comprehensive toolkit means you can build a distributed microservice architecture without hunting for compatible libraries or reinventing the wheel.

## Traditional framework features on top of coroutines

Rest assured that Hyperf remains a full-featured PHP framework. According to the README, it includes middleware, event management, a coroutine-optimized Eloquent ORM with model caching, translation, validation, and view engines (Blade, Smarty, Twig, Plates, ThinkTemplate). If you have used Laravel or another PHP framework, these components are recognizable. The difference is that they operate within coroutine contexts and can call I/O without blocking the event loop. This means your route handlers can perform multiple concurrent database queries, cache lookups, and API calls without spawning additional processes. The event manager lets you hook into framework lifecycle events. Middleware runs the same way as in traditional frameworks but scales to thousands of concurrent requests.

## Getting started with Nano or the full skeleton

Hyperf comes in two flavors for different project sizes. According to the README, Nano is a zero-config minimal distribution that allows you to quickly build a Hyperf application with just a single PHP file, without needing a skeleton project structure. For larger applications, use the full skeleton, which provides directory organization, middleware, view engines, and database integration. The official website (hyperf.io) and documentation (hyperf.wiki) provide installation instructions for each path. Start with Nano if you are prototyping a microservice or API. Use the full skeleton if you are building a more complex application with multiple components.

## Ecosystem tools for deployment and integration

The Hyperf ecosystem includes specialized tools beyond the core framework. According to the README, Nano is a zero-config minimal distribution for building a Hyperf application with just a single PHP file, without needing a skeleton project structure. GoTask spawns a Go process as a Swoole sidecar to offload compute-heavy work to Go, useful when you need CPU-intensive operations. Jet is a unified RPC client supporting JSON-RPC, usable in both PHP-FPM and Swoole/Hyperf environments, enabling gradual migration or mixed deployments. Box helps package Hyperf applications as binary distributions and provides reverse proxy services for managing deployments. These tools target the needs of teams running distributed systems, wanting to mix PHP with other languages, or needing to package and deploy applications without traditional package managers.

## System requirements and production status

Hyperf requires PHP 8.1 or later, plus Swoole 5.0+ or Swow 1.4+. According to the README, it runs on Linux, OS X, Cygwin, WSL and Windows. Before public release in June 2019, Hyperf ran in production at medium and large Internet companies for years without incident. The README confirms that a large number of unit tests validate each component, and multilingual documentation is maintained. This is not a brand-new framework; it is a mature choice with a track record.

## Performance verification via benchmarking

The README includes a performance benchmark measured on an Aliyun 8-core 16 GB machine. According to the README, the test was run with wrk:

```bash
wrk -c 1024 -t 8 http://127.0.0.1:9501/
```

This command sends 1024 concurrent connections across 8 threads to a Hyperf endpoint. The README reports 103,921 requests per second with average latency of 10.08 ms. For your own deployment, measure performance in your environment, not just against the published numbers. A Hyperf server on commodity hardware will vary with the code you write, the database queries you run, and the network conditions. Use wrk or similar tools to verify performance against your application.

## The learning curve and operational model

Adopting Hyperf means adopting the Swoole event loop and coroutine model. If your team is experienced with Swoole or Swow, the transition is smooth. If not, the learning curve is steep. You must understand coroutines, how I/O works in an event loop, and why you cannot call blocking libraries from within a coroutine. The operational model is also different: instead of spawning new processes per request, you boot a long-lived Hyperf server and manage its lifecycle. This is not a limitation but a constraint that affects deployment, testing and troubleshooting.

## Conclusion

Hyperf is for teams building PHP microservices or real-time applications and able to commit to the Swoole/Swow ecosystem. Do not choose it if your hosting only offers PHP-FPM, or if your team has no experience with coroutines and cannot hire or train for that gap. If you are comfortable with Swoole and want ORM, caching, and async I/O from the ground up, Hyperf's flexibility pays off. Verify that your host supports Swoole 5.0+ or Swow 1.4+ before migrating an existing application.

## FAQ

### What are the system requirements for Hyperf?

Hyperf requires PHP 8.1+, Swoole 5.0+ or Swow 1.4+. According to the README, it runs on Linux, OS X, Cygwin, WSL and Windows.

### How does Hyperf compare to Laravel or Symfony?

Hyperf is built on coroutines (Swoole/Swow) instead of the traditional PHP-FPM process-per-request model, enabling higher concurrency. The README notes that Hyperf beats PHP-FPM frameworks in benchmarks. However, it requires knowledge of the Swoole event loop to use safely.

### Does Hyperf include an ORM?

Yes. According to the README, Hyperf includes a coroutine-optimized Eloquent ORM with model caching. It also includes middleware, event management, validation, translation, and view engines.

### Can I use Hyperf with other languages?

Yes. The Hyperf ecosystem includes GoTask, which spawns a Go process as a Swoole sidecar to offload compute-heavy work to Go. Jet is an RPC client that works in both PHP-FPM and Swoole/Hyperf environments.

### What infrastructure does Hyperf support?

According to the README, Hyperf includes coroutine clients for MySQL, Redis, WebSocket, JSON-RPC, gRPC, Elasticsearch, Consul, ETCD, AMQP, and message queues (RabbitMQ, NSQ, NATS). It also supports Zipkin/Jaeger tracing and configuration centers.

## Sources

- [hyperf/hyperf on GitHub](https://github.com/hyperf/hyperf)
- [License: MIT](https://github.com/hyperf/hyperf/blob/master/LICENSE)
- [Project website](https://www.hyperf.io)
- [README](https://github.com/hyperf/hyperf/blob/master/README.md)
- [Releases](https://github.com/hyperf/hyperf/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/hyperf-hyperf
