Introducing hadroton
PHP templating engines usually define their own syntax. So, to produce HTML you need to learn a new language and use different tools for development. Somehow I find this strange. HTML data is just text and PHP has no trouble manipulating text.
Compare it with software to interact with databases. Then we use PHP components that create a representation of the database elements. These components interface with the database and manipulate the stored data.
We don't write software and ask a database administrator to define all the SQL statements to manipulate the database as (s)he thinks is best. But that's what we're doing with HTML data.
So, why not use PHP directly to create HTML data?
This is what hadroton does.
Hadroton is a plain PHP component to generate HTML output directly in PHP code. The advantages of using this library over a dedicated templating system:
- there is no need to learn a separate template language.
- all normal PHP tools to develop, refactor and test source code can be used.
- HTML output and the elements are PHP objects. This allows normal manipulation and extension using object oriented techniques.
- there are no separate templates to compile or interpret.
Hadroton is a work in progress and there is no release yet. But I've made it available on packagist so you can pick it up for experimentation. Just remember to declare the version dev-master
for the requirement.