bjornbasar/karhu-view
Composer 安装命令:
composer require bjornbasar/karhu-view
包简介
Template engine bridge for the karhu PHP microframework
README 文档
README
Template engine bridge for the karhu PHP microframework.
Provides a ViewInterface so controllers can render templates without coupling to a specific engine. Ships with Twig and Plates adapters.
Install
composer require bjornbasar/karhu-view # Then install your preferred engine: composer require twig/twig # for Twig # or composer require league/plates # for Plates
Usage
use Karhu\View\TwigAdapter; $view = new TwigAdapter(__DIR__ . '/templates'); $html = $view->render('home.html.twig', ['name' => 'karhu']); return (new Response())->withHeader('Content-Type', 'text/html')->withBody($html);
Custom engines
Implement ViewInterface:
use Karhu\View\ViewInterface; final class BladeAdapter implements ViewInterface { public function render(string $template, array $data = []): string { /* ... */ } }
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 5
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-04-14