vssl/render
Composer 安装命令:
composer require vssl/render
包简介
Rendering agent for Journey Group’s Vessel Pages.
README 文档
README
What
This package contains a PHP rendering agent for Vessel Pages. It includes a PSR-15 middleware implementation to easily attach to any conforming framework and will automatically consume the Vessel Pages API and render production-ready markup.
Configuration
use Vssl\Resolver; use Journey\Cache\LocalAdapter; $config = [ 'cache' => new LocalAdapter('/tmp') ]; Resolver::config($config); // for manual instantiation, you can also pass in a configuration. $resolver = new Resolver($request, $config);
Configuration options
The only required configuration option is an implementation of
Journey\Cache\CacheAdapterInterface.
| Option | Description |
|---|---|
cache |
Instance of Journey\Cache\CacheAdapterInterface (or null to disable) |
cache_ttl |
Integer, number of seconds to store in cache |
base_uri |
URI for Vessel API interaction |
base_path |
Path to add to base_uri for versioned Vessel API interaction |
required_fields |
Keys required for API data to be considered valid |
templates |
Additional directory to find custom render templates |
How
Attach the middleware to your favorite PSR-15 dispatcher
before your router. When the request arrives in your controller methods, it will
have an attribute vssl-page with content ready to be rendered.
<?php namespace App\Controllers; class YourController { /** * Any controller method. */ public function anypage(ServerRequestInterface $request) { $page = $request->getAttribute('vssl-page'); } }
统计信息
- 总下载量: 477
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2017-03-01