hyperf / hyperf
A coroutine framework that focuses on hyperspeed and flexibility. Building microservice or middleware with ease.
Fund package maintenance!
Open Collective
hyperf.wiki/#/zh-cn/donate
Installs: 2 448
Dependents: 1
Suggesters: 1
Security: 0
Stars: 6 225
Watchers: 122
Forks: 1 211
Open Issues: 320
Requires
- php: >=8.1
- ext-bcmath: *
- ext-json: *
- ext-pdo: *
- ext-redis: *
- ext-swoole: >=5.0
- psr/container: ^1.0 || ^2.0
- psr/event-dispatcher: ^1.0
- psr/http-message: ^1.0 || ^2.0
- psr/http-server-middleware: ^1.0
- psr/log: ^1.0 || ^2.0 || ^3.0
- psr/simple-cache: ^1.0 || ^2.0 || ^3.0
Requires (Dev)
- doctrine/dbal: ^3.6
- doctrine/inflector: ^2.0
- doctrine/instantiator: ^1.0
- egulias/email-validator: ^3.0
- elasticsearch/elasticsearch: ^7.0
- ergebnis/composer-normalize: ^2.43
- fakerphp/faker: ^1.23
- fig/http-message-util: ^1.1.2
- filp/whoops: ^2.7
- friendsofphp/php-cs-fixer: ^3.63
- google/common-protos: ^3.2 || ^4.4
- google/protobuf: ^3.6.1
- grpc/grpc: ^1.15
- guzzlehttp/guzzle: ^6.3 || ^7.0
- hyperf/engine: ^2.11
- hyperf/token-bucket: ^2.0
- influxdb/influxdb-php: ^1.15.0
- ircmaxell/random-lib: ^1.2
- jcchavezs/zipkin-opentracing: ^2.0
- jean85/pretty-package-versions: ^2.0
- jetbrains/phpstorm-attributes: ^1.0
- jonahgeorge/jaeger-client-php: ^1.0
- laminas/laminas-mime: ^2.7
- league/flysystem: ^1.0 || ^2.0 || ^3.0
- league/flysystem-aws-s3-v3: ^1.0 || ^2.0 || ^3.0
- league/flysystem-memory: ^1.0 || ^2.0 || ^3.0
- league/plates: ^3.3
- longlang/phpkafka: ^1.2.3
- markrogoyski/math-php: ^2.0
- mix/redis-subscriber: ^3.0.4
- mockery/mockery: ^1.0
- monolog/monolog: ^2.7 || ^3.1
- multiplex/socket: ^1.0
- nesbot/carbon: ^2.0
- nikic/fast-route: ^1.3
- nikic/php-parser: ^4.1
- opentracing/opentracing: ^1.0
- php-amqplib/php-amqplib: ^3.5
- php-di/phpdoc-reader: ^2.2
- phpstan/phpstan: ^1.0
- phpunit/phpunit: ^10.1.3
- predis/predis: ^1.1
- promphp/prometheus_client_php: ~2.2.0
- ramsey/uuid: ^4.7
- reactivex/rxphp: ^2.0
- rector/rector: ^0.17.0
- slickdeals/statsd: ^3.0.1
- smarty/smarty: ^3.1
- squizlabs/php_codesniffer: ^3.4
- swoole/ide-helper: dev-master
- swow/psr7-plus: ^1.0
- swow/swow: dev-develop
- sy-records/think-template: ^2.0
- symfony/console: ^5.0 || ^6.0
- symfony/event-dispatcher: ^5.0 || ^6.0
- symfony/finder: ^5.0 || ^6.0
- symfony/http-foundation: ^5.4 || ^6.0
- symfony/property-access: ^5.0 || ^6.0
- symfony/serializer: ^5.0 || ^6.0
- symfony/uid: ^5.0 || ^6.0
- symfony/var-dumper: ^5.0 || ^6.0
- thecodingmachine/graphqlite: ^7.0
- twig/twig: ^3.0
- vlucas/phpdotenv: ^5.0
- zircote/swagger-php: ^4.6
Replaces
- hyperf/amqp: *
- hyperf/async-queue: *
- hyperf/cache: *
- hyperf/carbon: *
- hyperf/circuit-breaker: *
- hyperf/code-parser: *
- hyperf/codec: *
- hyperf/collection: *
- hyperf/command: *
- hyperf/conditionable: *
- hyperf/config: *
- hyperf/config-aliyun-acm: *
- hyperf/config-apollo: *
- hyperf/config-center: *
- hyperf/config-etcd: *
- hyperf/config-nacos: *
- hyperf/config-zookeeper: *
- hyperf/constants: *
- hyperf/consul: *
- hyperf/context: *
- hyperf/contract: *
- hyperf/coordinator: *
- hyperf/coroutine: *
- hyperf/crontab: *
- hyperf/dag: *
- hyperf/database: *
- hyperf/database-pgsql: *
- hyperf/database-sqlite: *
- hyperf/db: *
- hyperf/db-connection: *
- hyperf/devtool: *
- hyperf/di: *
- hyperf/dispatcher: *
- hyperf/elasticsearch: *
- hyperf/etcd: *
- hyperf/event: *
- hyperf/exception-handler: *
- hyperf/filesystem: *
- hyperf/framework: *
- hyperf/graphql: *
- hyperf/grpc: *
- hyperf/grpc-client: *
- hyperf/grpc-server: *
- hyperf/guzzle: *
- hyperf/http-message: *
- hyperf/http-server: *
- hyperf/http2-client: *
- hyperf/ide-helper: *
- hyperf/json-rpc: *
- hyperf/kafka: *
- hyperf/load-balancer: *
- hyperf/logger: *
- hyperf/macroable: *
- hyperf/memory: *
- hyperf/metric: *
- hyperf/migration-generator: *
- hyperf/model-cache: *
- hyperf/model-listener: *
- hyperf/nacos: *
- hyperf/nats: *
- hyperf/nsq: *
- hyperf/paginator: *
- hyperf/phar: *
- hyperf/pipeline: *
- hyperf/pool: *
- hyperf/process: *
- hyperf/protocol: *
- hyperf/rate-limit: *
- hyperf/reactive-x: *
- hyperf/redis: *
- hyperf/resource: *
- hyperf/resource-grpc: *
- hyperf/retry: *
- hyperf/rpc: *
- hyperf/rpc-client: *
- hyperf/rpc-multiplex: *
- hyperf/rpc-server: *
- hyperf/rpn: *
- hyperf/scout: *
- hyperf/serializer: *
- hyperf/server: *
- hyperf/service-governance: *
- hyperf/service-governance-consul: *
- hyperf/service-governance-nacos: *
- hyperf/session: *
- hyperf/signal: *
- hyperf/snowflake: *
- hyperf/socket: *
- hyperf/socketio-server: *
- hyperf/stdlib: *
- hyperf/stringable: *
- hyperf/super-globals: *
- hyperf/support: *
- hyperf/swagger: *
- hyperf/tappable: *
- hyperf/task: *
- hyperf/testing: *
- hyperf/tracer: *
- hyperf/translation: *
- hyperf/utils: *
- hyperf/validation: *
- hyperf/view: *
- hyperf/view-engine: *
- hyperf/watcher: *
- hyperf/websocket-client: *
- hyperf/websocket-server: *
- dev-master
- 3.1.x-dev
- v3.1.44
- v3.1.43
- v3.1.42
- v3.1.41
- v3.1.40
- v3.1.39
- v3.1.38
- v3.1.37
- v3.1.36
- v3.1.35
- v3.1.34
- v3.1.33
- v3.1.32
- v3.1.31
- v3.1.30
- v3.1.29
- v3.1.28
- v3.1.27
- v3.1.26
- v3.1.25.1
- v3.1.25
- v3.1.24
- v3.1.23
- v3.1.22
- v3.1.21
- v3.1.20
- v3.1.19
- v3.1.18
- v3.1.17
- v3.1.16
- v3.1.15
- v3.1.14
- v3.1.13
- v3.1.12
- v3.1.11
- v3.1.10
- v3.1.9
- v3.1.8
- v3.1.7
- v3.1.6
- v3.1.5
- v3.1.4
- v3.1.3
- v3.1.2
- v3.1.1
- v3.1.0
- v3.1.0-rc.15
- v3.1.0-rc.14
- v3.1.0-rc.13
- v3.1.0-rc.12
- v3.1.0-rc.11
- v3.1.0-rc.10
- v3.1.0-rc.9
- v3.1.0-rc.8
- v3.1.0-rc.7
- v3.1.0-rc.6
- v3.1.0-rc.5
- v3.1.0-rc.4
- v3.1.0-rc.3
- v3.1.0-rc.2
- v3.1.0-rc.1
- v3.1.0-beta.14
- v3.1.0-beta.13
- v3.1.0-beta.12
- v3.1.0-beta.11
- v3.1.0-beta.10
- v3.1.0-beta.9
- v3.1.0-beta.8
- v3.1.0-beta.7
- v3.1.0-beta.6
- v3.1.0-beta.5
- v3.1.0-beta.4
- v3.1.0-beta.3
- v3.1.0-beta.2
- v3.1.0-beta.1
- v3.1.0-alpha.2
- v3.1.0-alpha.1
- 3.0.x-dev
- v3.0.49
- v3.0.48
- v3.0.47
- v3.0.46
- v3.0.45
- v3.0.44
- v3.0.43
- v3.0.42
- v3.0.41
- v3.0.40
- v3.0.39
- v3.0.38
- v3.0.37
- v3.0.36
- v3.0.35
- v3.0.34
- v3.0.33
- v3.0.32
- v3.0.31
- v3.0.30
- v3.0.29
- v3.0.28
- v3.0.27
- v3.0.26
- v3.0.25
- v3.0.24
- v3.0.23
- v3.0.22
- v3.0.21
- v3.0.20
- v3.0.19
- v3.0.18
- v3.0.17
- v3.0.16
- v3.0.15
- v3.0.14
- v3.0.13
- v3.0.12
- v3.0.11
- v3.0.10
- v3.0.9
- v3.0.8
- v3.0.7
- v3.0.6
- v3.0.5
- v3.0.4
- v3.0.3
- v3.0.2
- v3.0.1
- v3.0.0
- v3.0.0-rc.21
- v3.0.0-rc.20
- v3.0.0-rc.19
- v3.0.0-rc.18
- v3.0.0-rc.17
- v3.0.0-rc.16
- v3.0.0-rc.15
- v3.0.0-rc.14
- v3.0.0-rc.13
- v3.0.0-rc.12
- v3.0.0-rc.11
- v3.0.0-rc.10
- v3.0.0-rc.9
- v3.0.0-rc.8
- v3.0.0-rc.7
- v3.0.0-rc.6
- v3.0.0-rc.5
- v3.0.0-rc.4
- v3.0.0-rc.3
- v3.0.0-rc.2
- v3.0.0-rc.1
- v3.0.0-beta.14
- v3.0.0-beta.13
- v3.0.0-beta.12
- v3.0.0-beta.11
- v3.0.0-beta.10
- v3.0.0-beta.9
- v3.0.0-beta.8
- v3.0.0-beta.7
- v3.0.0-beta.6
- v3.0.0-beta.5
- v3.0.0-beta.3
- v3.0.0-beta.2
- v3.0.0-beta.1
- v3.0.0-alpha.12
- v3.0.0-alpha.11
- v3.0.0-alpha.10
- v3.0.0-alpha.9
- v3.0.0-alpha.8
- v3.0.0-alpha.7
- v3.0.0-alpha.6
- v3.0.0-alpha.5
- v3.0.0-alpha.4
- v3.0.0-alpha.3
- v3.0.0-alpha.2
- v3.0.0-alpha.1
- 2.2.x-dev
- v2.2.41
- v2.2.40
- v2.2.39
- v2.2.38
- v2.2.37
- v2.2.36
- v2.2.35
- v2.2.34
- v2.2.33
- v2.2.32
- v2.2.31
- v2.2.30
- v2.2.29
- v2.2.28
- v2.2.27
- v2.2.26
- v2.2.25
- v2.2.24
- v2.2.23
- v2.2.22
- v2.2.21
- v2.2.20
- v2.2.19
- v2.2.18
- v2.2.17
- v2.2.16
- v2.2.15
- v2.2.14
- v2.2.13
- v2.2.12
- v2.2.11
- v2.2.10
- v2.2.9
- v2.2.8
- v2.2.7
- v2.2.6
- v2.2.5
- v2.2.4
- v2.2.3
- v2.2.2
- v2.2.1
- v2.2.0
- v2.2.0-rc4
- v2.2.0-rc3
- v2.2.0-rc2
- v2.2.0-rc1
- v2.2.0-beta2
- v2.2.0-beta1
- v2.2.0-alpha
- 2.1.x-dev
- v2.1.23
- v2.1.22
- v2.1.21
- v2.1.20
- v2.1.19
- v2.1.18
- v2.1.17
- v2.1.16
- v2.1.15
- v2.1.14
- v2.1.13
- v2.1.12
- v2.1.11
- v2.1.10
- v2.1.9
- v2.1.8
- v2.1.7
- v2.1.6
- v2.1.5
- v2.1.4
- v2.1.3
- v2.1.2
- v2.1.1
- v2.1.0
- v2.1.0-beta3
- v2.1.0-beta1
- 2.0.x-dev
- v2.0.25
- v2.0.24
- v2.0.23
- v2.0.22
- v2.0.21
- v2.0.20
- v2.0.19
- v2.0.18
- v2.0.17
- v2.0.16
- v2.0.15
- v2.0.14
- v2.0.13
- v2.0.12
- v2.0.11
- v2.0.10
- v2.0.9
- v2.0.8
- v2.0.7
- v2.0.6
- v2.0.5
- v2.0.4
- v2.0.3
- v2.0.2
- v2.0.1
- v2.0.0
- 1.1.x-dev
- v1.1.32
- v1.1.31
- v1.1.30
- v1.1.29
- v1.1.28
- v1.1.27
- v1.1.26
- v1.1.25
- v1.1.24
- v1.1.23
- v1.1.22
- v1.1.21
- v1.1.20
- v1.1.19
- 1.1.18
- v1.1.17
- v1.1.16
- v1.1.15
- v1.1.14
- v1.1.13
- v1.1.12
- v1.1.11
- v1.1.10
- v1.1.9
- v1.1.8
- v1.1.7
- v1.1.6
- v1.1.5
- v1.1.4
- v1.1.3
- v1.1.2
- v1.1.1
- v1.1.0
- 1.0.x-dev
- v1.0.17
- v1.0.16
- v1.0.15
- v1.0.14
- v1.0.13
- v1.0.12
- v1.0.11
- v1.0.10
- v1.0.9
- v1.0.8
- v1.0.7
- v1.0.6
- v1.0.5
- v1.0.4
This package is auto-updated.
Last update: 2024-10-31 02:11:36 UTC
README
English | 中文
Introduction
Hyperf is an extremely performant and flexible PHP CLI framework, powered by a state-of-the-art coroutine server and a large number of battle-tested components. Aside from decisively beating PHP-FPM frameworks in benchmarks, Hyperf is unique in its focus on flexibility and composition. Hyperf ships with an AOP-enabling (aspect-oriented programming) dependency injector to ensure components and classes are pluggable and meta-programmable. All of Hyperf's core components strictly follow PSR standards and can be used in other frameworks.
Hyperf's architecture is built using a combination of Coroutines
, Dependency injection
, Events
, Annotations
, and AOP
. In addition to providing MySQL
, Redis
and other common coroutine clients, Hyperf
also provides coroutine compatible versions of WebSocket server / client
, JSON RPC server / client
, gRPC server / client
, Zipkin/Jaeger (OpenTracing) client
, Guzzle HTTP client
, Elasticsearch client
, Consul client
, ETCD client
, AMQP component
, Apollo configuration center
, Aliyun ACM
, ETCD configuration center
, Token bucket algorithm-based limiter
, Universal connection pool
, Circuit breaker
, Swagger
, Snowflake
, Simply Redis MQ
, RabbitMQ
, NSQ
, Nats
, Seconds level crontab
, Custom Processes
, etc. Therefore, developers can entirely avoid implementing coroutine compatible versions of these libraries.
Rest assured, Hyperf is still a PHP framework. Hyperf provides all the packages you expect: Middleware
, Event Manager
, Coroutine-optimized Eloquent ORM
(and Model Cache!), Translation
, Validation
, View engine (Blade/Smarty/Twig/Plates/ThinkTemplate)
and more.
Origin
Although there are many new PHP frameworks, we still haven't found a framework that matches an elegant design with ultra-high performance, nor have we found a framework that paves the way for PHP microservices. With this vision in mind, we will continue to invest in the future of this framework, and you are welcome to join us in contributing to the open-source development of Hyperf.
Design Goals
Hyperspeed + Flexibility = Hyperf
. The equation hidden in our name exhibits Hyperf's founding ambition.
Hyperspeed: Leveraging Swoole
and Swow
coroutines, Hyperf is capable of handling massive amounts of traffic. The Hyperf team made many optimizations to the framework to eliminate every bottleneck between the end-user and our blazing engine.
Flexibility: We believe our Dependency Injection component is best in class. With the help of Hyperf DI
, components and classes are all pluggable and meta-programmable. Inversely, all Hyperf components are meant to be shared with the world. Our commitment to PSR standards means that you can use Hyperf components in any compatible framework.
Via these traits, Hyperf has discovered the untapped potential in many fields: implementing Web servers, gateway servers, distributed middleware software, microservices architecture, game servers, and Internet-of-Things (IoT).
Operating environment
- Linux, OS X or Cygwin, WSL, Windows
- PHP 8.1+
- Swoole 5.0+ or Swow 1.4+
Production ready
Alongside our well-maintained, multilingual documentation, a large number of unit tests for each component ensure logical correctness. Before Hyperf
was released to the public (2019-06-20), it had been privately used by some medium and large Internet companies for multiple services, which have been running without incident for years in harsh production environments.
Official website and Documentation
Official website https://hyperf.io
Documentation https://hyperf.wiki
Security Vulnerabilities
If you discover a security vulnerability within Hyperf, please send an e-mail to the Hyperf Team via group@hyperf.io. All security vulnerabilities will be promptly addressed.
Code Contributors
This project exists thanks to all the people who contribute. [Contribute].
Code Contributor over time
Financial Contributors
Become a financial contributor and help us sustain our community. [Contribute]
Support this project with your organization or company. Your logo will show up here with a link to your website. [Contribute]
Performance
Aliyun 8 cores 16G ram
command: wrk -c 1024 -t 8 http://127.0.0.1:9501/
Running 10s test @ http://127.0.0.1:9501/ 8 threads and 1024 connections Thread Stats Avg Stdev Max +/- Stdevs Latency 10.08ms 6.82ms 56.66ms 70.19% Req/Sec 13.17k 5.94k 33.06k 84.12% 1049478 requests in 10.10s, 190.16MB read Requests/sec: 103921.49 Transfer/sec: 18.83MB
The Hyperf Ecosystem
- 🧬 Nano is a zero-config, no skeleton, minimal Hyperf distribution that allows you to quickly build a Hyperf application with just a single PHP file.
- ⚡️ GoTask is a library to spawns a go process as a Swoole sidecar and establishes a bi-directional IPC to offload heavy-duties to Go. Think of it as a Swoole Taskworker in Go.
- 🚀 Jet is a unification model RPC Client, built-in JSONRPC protocol, available to running in ALL PHP environments, including PHP-FPM and Swoole/Hyperf environments.
- 🧰 Box is committed to helping improve the programming experience of Hyperf applications, managing the PHP environment and related dependencies, providing the ability to package Hyperf applications as binary programs, and also providing reverse proxy services for managing and deploying Hyperf applications.
Stargazers over time
License
The Hyperf framework is open-source software licensed under the MIT license.