HTML rendering library with an API inspired by jQuery and React

2.0.0 2023-11-16 14:14 UTC

This package is auto-updated.

Last update: 2024-10-16 19:28:01 UTC


README

Source Code Latest Version Software License Build Status Coverage Status Quality Score

Framework agnostic HTML rendering utility with an API inspired by jQuery and React.

Elevator pitch

$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="me@domain.com">
</div>

<!-- the rest of the form goes here -->

</form>

Performance

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:

Of course, this is not a real world scenario, but it gives you an idea of what to expect from this library.

Links