RoadRunner adapter for Yii Runner 1.0.0
2022-01-26
1169次浏览
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
- auth client
- view
- bootstrap
- release
- Yii 2.0
- mongodb
- apidoc
- redis
- Yii 1.1
- gii
- runner
- console
- twig
- queue
- http 客户端
- extensions
- mailer
- html
- translator
- sphinx
- cache
- error handler
- log
- http
- db
- validation
- config
- widget
- 图书
- swiftmailer
- imagine
- symfonymailer
- hydrator
- IDE
- i18n
- assets
- elasticsearch
- router
- logging
- user
- smarty
- swagger
- definitions
- fastroute
- csrf