orbito/render-client
最新稳定版本:0.0.2
Composer 安装命令:
composer require orbito/render-client
包简介
HTTP Client for Orbito Render
README 文档
README
HTTP client to use with Orbito Render.
composer require orbito/render-client
use Psr\Http\Client\ClientInterface; use Psr\Http\Message\RequestFactoryInterface; use Psr\Http\Message\StreamFactoryInterface; use Psr\Log\LoggerInterface; use Orbito\RenderClient\RenderClient; use Orbito\RenderClient\TemplateRef; use Orbito\RenderClient\TemplateOptimize; $render_client = new RenderClient( [ 'default' => 'http://localhost:4250', ], ClientInterface $http_client, RequestFactoryInterface $request_factory, StreamFactoryInterface $stream_factory, LoggerInterface $logger, ); $content = $this->renderer->render( 'default', 'en', 'main', new TemplateRef('my-tpl', 'pages/default'), TemplateOptimize::makeFor('html'), [],// data [],// styleVars ['renderText' => true],// optional, options null|string,// optional, trace for logging ); if(!$content) { return; } error_log('Rendered in ' . $content->renderTime . 'ms'); $html = $content->rendered; $style = $this->renderer->style( 'default', 'main', 'my-tpl', ['nanoCss' => true, 'cssAutoPrefix' => false], [],// styleVars ); if(!$style) { return; } error_log('Generated style in ' . $style->styleTime . 'ms'); $css = $style->style;
Dev Notices
Commands to set up and run e.g. tests:
# on windows: docker run -it --rm -v %cd%:/app composer install docker run -it --rm -v %cd%:/var/www/html php:8-cli-alpine sh docker run --rm -v %cd%:/var/www/html php:8-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php" # on unix: docker run -it --rm -v `pwd`:/app composer install docker run -it --rm -v `pwd`:/var/www/html php:8-cli-alpine sh docker run --rm -v `pwd`:/var/www/html php:8-cli-alpine sh -c "cd /var/www/html && ./vendor/bin/phpunit --testdox -c phpunit-ci.xml --bootstrap vendor/autoload.php"
Versions
This project adheres to semver, until 1.0.0 and beginning with 0.1.0: all 0.x.0 releases are like MAJOR releases and all 0.0.x like MINOR or PATCH, modules below 0.1.0 should be considered experimental.
License
This project is free software distributed under the MIT LICENSE.
© 2022 bemit
Contributors
By committing your code to the code repository you agree to release the code under the MIT License attached to the repository.
统计信息
- 总下载量: 77
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-08-05