$ show mix-php/mix
MixPHP is a high-performance PHP framework designed for CLI-mode development, supporting multiple server drivers including Swoole, Swow, WorkerMan, PHP-FPM, and the built-in CLI server. The framework is built as a modular monorepo with over 30 independent packages covering HTTP routing (Vega), WebSocket, gRPC, database access, Redis, CLI commands, validation, event dispatching, caching, dependency injection, and microservice infrastructure (service registry, circuit breaker, distributed tracing). The architecture emphasizes coroutine-based concurrency via Swoole, allowing seamless switching between server runtimes with minimal code changes. All components follow PSR standards (PSR-7, PSR-14, PSR-17, PSR-3) and are designed to be used independently, enabling developers to pick only what they need. The framework provides full-stack capabilities for building REST APIs, web applications, WebSocket services, gRPC servers, CLI tools, and microservices. It includes connection pooling for database and Redis, a PSR-14 event dispatcher, a standalone validation library, a generic object pool pattern, and a bean container for dependency injection. Examples and skeleton projects (api, web, cli, grpc, websocket) are provided to accelerate development. The codebase is well-tested with PHPUnit and includes continuous integration via GitHub Actions for splitting the monorepo into individual packages. While the framework is actively maintained and demonstrates strong craftsmanship, some modules show signs of technical drift such as deprecated classes (e.g., FileSystemApplicationContext, legacy cache handlers), reliance on specific Swoole versions, and copied Composer utilities that may diverge over time. The documentation is primarily in Chinese, and the Go counterpart (mix-go/mix) may split community attention.
The LLM identified 4 files worth highlighting for reuse:
A standalone form validation library that supports multiple rule types (string, integer, email, phone, file, image, etc.), scenarios, custom callbacks, and static method invocation. It implements a clean validator pattern with BaseValidator abstract and concrete validators, all decoupled from the rest of the framework. Can be extracted into any PHP project with minimal adaptation.
A lightweight PSR-14 event dispatcher implementation with a listener provider and dispatcher. Demonstrates the observer pattern with clean separation of concerns. The module has no external dependencies and can be reused as a standalone event system.
A generic object pool pattern with abstract base class and DialerInterface for creating and closing objects. Used internally by database, Redis, and sync-invoke pools. It is self-contained, implements timeout and capacity control, and can be extracted as a reusable resource pooling library.
A full-featured Redis client with connection pooling, pipeline support, multi/transaction commands, and logging. It abstracts the underlying driver (Swoole, PHP redis extension) and implements all Redis commands via the ConnectionInterface. The module is self-contained and can be used independently in any PHP project.