A lightweight PHP library for rendering reusable HTML components — inspired by JSX, built on DOMDocument, no build step required.
composer require oscurlo/component-rendereruse Oscurlo\ComponentRenderer\ComponentRenderer;
$renderer = new ComponentRenderer([
'MyApp\\Components' => ['Button', 'Card'],
]);
$renderer->render('<Card title="Hello"><Button>Click me</Button></Card>');| # | 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 |
- PHP >= 8.0
- ext-dom
- ext-libxml

