GitHub - zendframework/zend-expressive-swoole: Swoole support for Expressive app...
source link: https://github.com/zendframework/zend-expressive-swoole
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
README.md
zend-expressive-swoole
This library provides the support of Swoole into an Expressive application. This means you can execute your Expressive application using Swoole directly from the command line.
Installation
Run the following to install this library:
$ composer require zendframework/zend-expressive-swoole
Configuration
After installing zend-expressive-swoole, you will need to first enable the component, and then optionally configure it.
We recommend adding a new configuration file to your autoload directory,
config/autoload/swoole.local.php
. To begin with, use the following contents:
<?php use Zend\Expressive\Swoole\ConfigProvider; return array_merge((new ConfigProvider())(), []);
The above will setup the Swoole integration for your application.
By default, Swoole executes the HTTP server with host 127.0.0.1
on port
8080
. You can change these values via configuration. Assuming you have the
above, modify it to read as follows:
<?php use Zend\Expressive\Swoole\ConfigProvider; return array_merge((new ConfigProvider())(), [ 'zend-expressive-swoole' => [ 'swoole-http-server' => [ 'host' => 'insert hostname to use here', 'port' => 80, // use an integer value here ], ], ]);
Expressive skeleton 3.1.0 and later
If you have built your application on the 3.1.0 or later version of the Expressive skeleton, you do not need to instantiate and invoke the package's
ConfigProvider
, as the skeleton supports it out of the box.You will only need to provide any additional configuration of the HTTP server.
Execute
Once you have performed the configuration steps as outlined above, you can run an Expressive application with Swoole using the following command:
php public/index.php
Documentation
Browse the documentation online at https://docs.zendframework.com/zend-expressive-swoole/
Support
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK