Framework agnostic HTML rendering utility with an API inspired by jQuery and React.
$h = new Sirius\Html\Builder;
$h->registerTag('user-login-form', 'MyApp\Html\Components\UserLoginForm');
echo $h->make('user-login-form', ['_form_values' => $_POST]);
which will output something like
<form method="post" action="user/login" class="form form-inline">
<div class="form-control">
<label for="email">Email/Username:</label>
<input type="email" name="email" id="email" value="[email protected]">
</div>
<!-- the rest of the form goes here -->
</form>
There is a simple benchmark that renders a form with 4 fields and a button. Compared to Twig, Sirius HTML is 50% slower but uses 2x less memory.
The benchmark results are as follows for 100K iterations:
Library | Time | Memory |
---|---|---|
Sirius HTML | 1.78s | 2Mb |
Twig | 1.14s | 4Mb |
Of course, this is not a real world scenario, but it gives you an idea of what to expect from this library.