highperapp/highper-php
Composer 安装命令:
composer require highperapp/highper-php
包简介
High-performance asynchronous PHP micro framework targeting C10M concurrency with maximum simplicity and peak performance
关键字:
README 文档
README
Enterprise PHP framework designed for high-scale production applications.
🚀 Quick Start
# Basic server bin/highper serve # Production with all optimizations bin/highper serve --workers=4 --c10m --rust=enabled --memory-limit=1G --zero-downtime # Dedicated ports mode bin/highper serve --mode=dedicated --http-port=8080 --ws-port=8081
🏗️ Hybrid Multi-Process + Async Architecture
Core Design: Combines process isolation with async I/O efficiency
- Multi-process worker spawning using
pcntl_fork() - RevoltPHP + UV hybrid event loop per worker
- Zero-downtime deployments with blue-green/rolling strategies
- C10M optimizations for 10 million concurrent connections
- Rust FFI integration for performance-critical components
Advanced CLI Features
bin/highper help # Show all architecture options bin/highper status # System capability check # Architecture options --workers=COUNT # Worker processes (auto-detect CPU cores) --mode=single|dedicated # Single port vs dedicated ports --c10m # C10M optimizations --rust=enabled # Rust FFI performance boost --zero-downtime # Zero-downtime deployments --deployment-strategy=blue_green # Deployment strategy --memory-limit=SIZE # Worker memory limit
🏗️ Architecture
Core Design Principles
- Interface-Driven: All contracts defined as interfaces (NO abstract classes)
- External Dependencies: Foundation components as external packages
- Service Providers: Package integration via auto-discovery
- Extension-Friendly: Everything extendable (NO final keywords)
- Rust FFI Enhancement: Strategic performance boosts where needed
Foundation Components
Foundation Dependencies:
├── RevoltPHP/EventLoop # Event loop foundation (C10M optimized)
├── AMPHP v3 ecosystem # Async/parallel infrastructure
├── amphp/http-server # HTTP server foundation (C10M ready)
├── amphp/parallel # Multi-process support (scalability)
├── highperapp/container # External PSR-11 container
├── highperapp/router # External ultra-fast router (O(1) lookups)
├── vlucas/phpdotenv # Environment configuration
└── filp/whoops # Error & exception handling
📦 Package Ecosystem
HighPer Framework supports 20+ standalone packages that can be used independently:
Foundation Packages (Required):
highperapp/container: PSR-11 container optimized for C10Mhighperapp/router: Ultra-fast router with O(1) lookups + Rust FFIhighperapp/zero-downtime: Zero-downtime deployment system
Optional Standalone Libraries:
highperapp/cache: Multi-driver async caching with Redis/Memcachedhighperapp/cli: Command-line interface frameworkhighperapp/crypto: Cryptographic operations with Rust FFIhighperapp/database: Async database with EventSourcing/CQRShighperapp/grpc: gRPC server integrationhighperapp/monitoring: Performance monitoring and metricshighperapp/paseto: PASETO v4 tokens with Rust FFIhighperapp/realtime: Real-time communication protocolshighperapp/security: Security enhancements and validationhighperapp/spreadsheet: High-performance spreadsheet manipulationhighperapp/stream-processing: Stream processing capabilitieshighperapp/tcp: TCP server and client implementationshighperapp/tracing: Distributed tracing and observabilityhighperapp/validator: Data validation with Rust FFIhighperapp/websockets: WebSocket streaming with backpressure
🦀 Rust FFI Integration
Strategic Rust components provide massive performance gains:
- Router: 10-50x improvement (O(1) radix tree vs PHP regex)
- Crypto: 5-20x improvement (native operations vs PHP)
- PASETO: 3-10x improvement (vs PHP JWT libraries)
- Validator: 2-5x improvement (native regex + validation)
📁 Project Structure
/home/user/highperapp/
├── src/
│ ├── Contracts/ # Framework interfaces (no abstract classes)
│ │ ├── ApplicationInterface.php
│ │ ├── ContainerInterface.php
│ │ ├── RouterInterface.php
│ │ ├── ConfigManagerInterface.php
│ │ └── ...
│ ├── Foundation/ # Core implementations
│ │ ├── Application.php # implements ApplicationInterface
│ │ ├── ConfigManager.php # implements ConfigManagerInterface
│ │ ├── AsyncLogger.php # implements LoggerInterface
│ │ └── ...
│ ├── ServiceProvider/ # Service provider system
│ │ ├── PackageDiscovery.php # Auto-discover packages
│ │ └── ...
│ └── ...
├── composer.json # Foundation dependencies
└── README.md
🚀 Quick Start
Installation
composer require highperapp/highper-php
Basic Usage
<?php use HighPerApp\HighPer\Foundation\Application; // Create application with auto-discovery $app = new Application([ 'packages' => [ 'auto_discover' => true, # Automatically load installed packages 'websockets' => true, # Enable WebSocket support 'database' => true, # Enable async database 'cache' => true, # Enable high-performance caching ] ]); // Bootstrap and run $app->bootstrap(); $app->run();
With Rust FFI Performance
# Build Rust components for maximum performance cd packages/highper-router/rust && ./build.sh cd packages/highper-crypto/rust && ./build.sh cd packages/highper-paseto/rust && ./build.sh cd packages/highper-validator/rust && ./build.sh
🧪 Comprehensive Testing
Professional test suite covering all architecture components:
# Run all tests php run-tests.php # Specific test suites php run-tests.php --suite=unit # Core components php run-tests.php --suite=integration # CLI and architecture php run-tests.php --suite=performance # C10M validation php run-tests.php --suite=concurrency # Multi-process safety # System capability check php run-tests.php --system-check
Test Coverage
- Unit Tests: ProcessManager, HybridEventLoop, ArchitectureValidator
- Integration Tests: CLI commands, multi-process architecture
- Performance Tests: C10M optimizations, memory efficiency
- Concurrency Tests: Thread safety, race condition prevention
📁 Key Implementation Files
src/Foundation/
├── ProcessManager.php # Multi-process worker management
├── HybridEventLoop.php # RevoltPHP + UV event loop
├── ArchitectureValidator.php # Configuration validation
└── Application.php # Main application bootstrap
tests/
├── Unit/ # Component unit tests
│ ├── ProcessManagerTest.php
│ ├── HybridEventLoopTest.php
│ └── ArchitectureValidatorTest.php
├── Integration/ # Integration tests
│ ├── MultiProcessArchitectureTest.php
│ └── CLIArchitectureTest.php
├── Performance/ # Performance validation
│ └── C10MArchitectureTest.php
└── Concurrency/ # Concurrency safety
└── MultiProcessConcurrencyTest.php
🔧 Requirements
- PHP: 8.3+ with pcntl, posix extensions
- Extensions:
- Required: pcntl, posix (for multi-process architecture)
- Recommended: ext-uv (15-25% performance boost), opcache, FFI (for Rust acceleration)
- Memory: 256MB+ per worker
- OS: Linux (recommended), macOS, Windows
Installing php-uv Extension (Recommended)
For optimal performance in high-concurrency scenarios, install the php-uv extension:
# Ubuntu/Debian sudo apt-get install libuv1-dev sudo pecl install uv # CentOS/RHEL sudo yum install libuv-devel sudo pecl install uv # macOS brew install libuv sudo pecl install uv # Add to php.ini echo "extension=uv" >> /etc/php/8.3/cli/php.ini
Performance Benefits with php-uv:
- 15-25% performance boost in high-concurrency scenarios
- 20-30% memory reduction in event loop operations
- Improved I/O performance for file operations and network connections
- Better timer precision and efficiency
📝 License
MIT License. See LICENSE file for details.
🤝 Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
Built with ❤️ for C10M performance and maximum simplicity from Hyderabad, India.
highperapp/highper-php 适用场景与选型建议
highperapp/highper-php 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 06 月 28 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「framework」 「microframework」 「async」 「concurrent」 「non-blocking」 「amphp」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 highperapp/highper-php 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 highperapp/highper-php 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 highperapp/highper-php 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP Framework HLEB2 is the foundation of the web application. Provides ease of development and application performance.
The bundle for easy using json-rpc api on your project
An async event for hyperf.
A lightweight, secure-by-default PHP microframework built on Slim – providing Laravel-like features (ORM, authentication, migrations, caching) without the bloat. Perfect for building REST APIs and small-to-medium PHP applications.
Zenity allows you to build graphical desktop (GUI) applications in PHP, built on top of ReactPHP.
Async Curl using React\ChildProcess
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 38
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-06-28