oscurlo/component-renderer
最新稳定版本:v1.2.0
Composer 安装命令:
composer require oscurlo/component-renderer
包简介
Lightweight PHP library for rendering reusable HTML components — inspired by JSX, built on DOMDocument, no build step required.
README 文档
README
A lightweight PHP library for rendering reusable HTML components — inspired by JSX, built on DOMDocument, no build step required.
Documentation
Quick start
composer require oscurlo/component-renderer
use Oscurlo\ComponentRenderer\ComponentRenderer; $renderer = new ComponentRenderer([ 'MyApp\\Components' => ['Button', 'Card'], ]); $renderer->render('<Card title="Hello"><Button>Click me</Button></Card>');
Examples
| # | What it shows |
|---|---|
| example1.php | Multiple components — functions, namespaces, class methods |
| example2.php | Output buffering with start() / end() |
| example3.php | Templates with variables via Component::template() |
| example4.php | Static API with Component::render() |
| example5.php | PropsCaster — type-safe props (bool, int, array…) |
| example6.php | Nested components + Bootstrap::accordion inside a card |
Requirements
- PHP >= 8.0
- ext-dom
- ext-libxml
Support
统计信息
- 总下载量: 57
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 4
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-09-28
