sikessem / html
Handle HTML5 and CSS3 easily
dev-main
2021-07-20 16:23 UTC
Requires
- php: >=8.0
This package is auto-updated.
Last update: 2024-12-20 23:28:25 UTC
README
Handle HTML5 and CSS3 easily
An example to see how the code works :
The Styper
code
<html>
[lang="fr"]
{color:red;}
(
<head>
(
<meta>[charset="UTF-8"]
<title>(Styper source)
)
<body>
(
<p>[id="main-content"]{color:blue}(Welcome to Styper !)
)
)
The equivalent HTML5
code
<!DOCTYPE html> <html lang="fr"> <head> <meta charset="UTF-8"/> <title>Styper source</title> <style> html { color: red; } p#main-content { color: blue; } </style> </head> <body> <p>Welcome to Styper !</p> </body> </html>
The equivalent PHP5
code
<?php use Styper\Document; require 'vendor/autoload.php'; $document = new Document('html', 5); $document->setAttribute('lang', 'fr'); $document->setProperty('color', 'red'); $document->head->meta->charset = 'UTF-8'; $document->title = 'Welcome to Styper !'; $p = $document->createElement('p'); $p->setAttribute('id', 'main-content'); $p->setProperty('color', 'red'); $p->setContent('Welcome to Styper !'); $document->prepend($p, $body); $document->save();