RoadRunner adapter for Yii Runner 1.0.0
2022-01-26
1294次浏览
First release of RoadRunner adapter for Yii Runner was tagged.
Despite popular belief, PHP application doesn't have to die and re-initilize every request and, thanks to RoadRunner Yii3 application could work in "initilize once" mode. There are multiple profits in using RoadRunner:
- Higher performance because all the framework initialization is done only once and the initialized worker may handle multiple request-responses.
- Tight Golang-PHP integration via Goridge RPC protocol.
- HTTP/2, gRPC, PSR-7 out of the box.
- Easy to pack into Docker since there's no need for PHP-FPM. Responses are served directly as HTTP.
- Out of the box logging and monitoring capabilities.
- Efficient queue supporting memory, AMQP, SQS, and Beanstalk.
There are two things that will be different from the application standpoint. First, instead of index.php
there will be worker.php
:
<?php
declare(strict_types=1);
use Yiisoft\Yii\Runner\RoadRunner\RoadRunnerApplicationRunner;
ini_set('display_errors', 'stderr');
require_once __DIR__ . '/autoload.php';
(new RoadRunnerApplicationRunner(__DIR__, $_ENV['YII_DEBUG'], $_ENV['YII_ENV']))->run();
That is quite similar to regular index.php
.
Another thing is more serious. All the services should:
- Either have no state or use state reset.
- Leak no memory. See details in the draft guide article.
新闻归档
热门标签
- yii3
- 扩展
- 发布
- yii2
- debug
- view
- auth client
- html
- bootstrap
- release
- redis
- apidoc
- Yii 2.0
- Yii 1.1
- mongodb
- mailer
- extensions
- gii
- twig
- queue
- runner
- http 客户端
- console
- validation
- sphinx
- cache
- widget
- translator
- hydrator
- error handler
- db
- symfonymailer
- log
- http
- config
- assets
- swiftmailer
- 图书
- imagine
- csrf
- elasticsearch
- swagger
- IDE
- i18n
- router
- definitions
- fastroute
- logging
- smarty
- user