What is MixPHP

Swoole is a high-performance PHP framework developed based on Swoole. After two years of development, it has gained the support of many small and medium-sized teams. The framework version has experienced:

  • V1.*Swoole – based resident memory PHP high-performance framework
  • V2.0Swoole-based FastCGI, resident memory, coroutine three-mode PHP high-performance framework
  • V2.1: Based on Swoole 4.4+ single-threaded coroutine PHP framework 🆕

update

This v2.1 reconstruction mainly modified the core package part of the framework, while the use mode of functional libraries such as Database/Redis/Auth is only slightly adjusted. The reconstruction content is as follows:

  • The mix-php/mix library can be changed into a submodule, which contains all libraries of the framework. When require MIX /mix, the library will replace the library of the same name on composer. When users submit PR, they only need to modify the library submission, and contributions will appear in mix-php/mix.
  • From the previous multi-process model to the single process model developed based on Swoole\Coroutine\Server, completely Coroutine.
  • The packaging concept of coroutine component automatic isolation container and App container has been removed, and the development mode of using coroutine Server directly, like Golang style, has been modified. The previous library packaging code has been moved to skeleton code, so that users can modify every detail in a more fine-grained way.
  • All composer dependency libraries are reduced from 25 to 20, all independent, no strong dependencies, and support for 8 PSR specifications.
  • Enhanced Bean dependency injection, removing the previous global component concept and replacing it with Bean SINGLETON.
  • Add mix/ Event library to introduce event mechanism.

Compare with other Swoole-based frameworks

All the servers are developed based on Swoole\Coroutine\Server, and the thread model is single-process single-thread model like Node.js (other Swoole frameworks are basically multi-process model), and the component encapsulation style refers to Golang. This allows you to have Golang’s CSP concurrency model without having to deal with data concurrency security as Golang does.

The framework is lightweight and flexible. All existing components are based on the PSR standard and can be used independently. Strictly speaking, Mix only encapsulates the Mix /console command line development components, and all other components are optional.

The framework integrates many out-of-the-box components for rapid development, all very similar to Golang’s usage style.

Our development document is probably the most detailed framework of all, the source code comes with Demo, a little modification can be used.

Full use of Swoole native coroutines and the latest PHP Stream one-click coroutine technology.

In a highly flexible development approach similar to Golang, the framework provides only the underlying libraries, while the code for specific functions is implemented in the project library, allowing users to change every detail in a more granular manner.

Development of the document

MixPHP Development Guide:

  • doc.mixphp.cn
  • www.kancloud.cn/onanying/mi…

Github

  • github.com/mix-php/mix