preface

Zend Framework is the official Framework for PHP. With zend-expressing-swoole 0.2.2, Swoole 4 was first supported for its coroutine functionality. It is now possible to run an entire application in coroutine mode with a single configuration. The Zend Expressive design is Expressive and decoupled, making it easy to build a high-performance frame that suits your own needs.

Zend Expressive builds a frame that I like

Composer create-project ZendFramework/zend-expression-skeleton folder_name is set in Composer for the component to be installed. Folder_name is changed to the name of the folder you want to store

As you can see from the picture above, the installer will ask you a few questions, that is, ask you to select the components you want, and theoretically support all PSR compliant components.

1. Which route do you want to use? [1] Aura.Router [2] FastRoute [3] Zend Router 2. Which dependency injection container do you want to use? [1] Aura.Di [2] Pimple [3] Zend ServiceManager 3. Which template engine do you want to use? Plates [2] Twig [3] Zend View [n] Plates [2] Twig [3] Zend View [n] Do not use 4. Which error handler do you want to use? [1] Whoops [n] is not used

After making the selection, the installer will automatically install the relevant dependencies according to your needs, and the foundation of a framework is built. The whole process is extremely simple, the simplest of all.

Use the Zend Expressive — Swoole

Swoole is configured by a server that has Swoole 4 or higher. (Note that you need to enable mysqlnd to enable PDO to coprogram.) / / Zend Composer requires ZendFramework/zend-expressing-swoole; / / Zend Composer requires ZendFramework/zend-expressing-swoole; / / Zend Composer requires ZendFramework/zend-expressing-swoole. Then add a configuration file within the project/config/autoload swoole. Local. PHP, and according to the following configuration

use Zend\Expressive\Swoole\ConfigProvider; return array_merge((new ConfigProvider())(), [' zend - expressive - swoole '= > [' swoole - HTTP server = > [' host' = > '0.0.0.0' and 'port' = > 80, / / port 'options' = > [' enable_coroutine' = > true, / / coroutines configuration switch],,,]]);

Now you just need to execute PHP public/index. PHP start from the command line and run your Zend Framework in coroutine mode on Swoole.

conclusion

Since Zend is not popular in China, it may not help many developers in China. This article is only for a guide. If you are interested in Zend, you can check the official documentation directly for more information. Interested can also learn about it.