@@ -13,27 +13,31 @@ status pages, TOC pages, or any other minimal single-serving site.
1313
1414## Vision
1515
16- This package provides a single class to turn a text or HTML-snippet into a valid
17- HTML5 document.
16+ This package provides a single class to turn a message or HTML-snippet into
17+ a valid HTML5 document.
1818
1919This way it is possible to let an app return an HTML response without the need
2020to store a template file beforehand or initialize a full-blown template engine.
2121
22- The package therefore does not have template variables, modifiers or parsers.
23- Three lines of code should be sufficient to wrap a given message into a valid
24- HTML document. See [ »Usage«] ( #usage ) for some examples.
22+ The package therefore does not have template variables or modifiers.
23+ Two lines of code should be sufficient to wrap a given text into a valid
24+ HTML document. One more to add a link to fancy stylesheet.
25+
26+ See [ »Usage«] ( #usage ) for some examples.
2527
2628The package follows the KISS principle.
2729
2830## Webapp
2931
3032This package is used on [ html5example.com] ( https://html5example.com/ ) .
3133
32- If you are in need of an HTML document once only, then use a commandline tool
33- like HTTPie and run ` http https://html5example.com > index.html ` .
34+ If you are in need of an HTML document once only, then you may use a
35+ commandline tool like HTTPie and run
36+ ` http https://html5example.com > index.html ` to save a template file.
3437
3538The webapp supports some [ options] ( #options ) of this package as well,
36- for example ` http POST https://html5example.com title=Minimal-Template > index.html `
39+ for example
40+ ` http POST https://html5example.com title=Minimal-Template > index.html `
3741to pass a custom title.
3842
3943## Requirements
@@ -48,29 +52,42 @@ Packagist Entry https://packagist.org/packages/pixelbrackets/html5-mini-template
4852
4953https://gitlab.com/pixelbrackets/html5-mini-template/
5054
55+ Mirror https://github.com/pixelbrackets/html5-mini-template
56+
5157## Usage
5258
53- 1 . Get the example template
59+ 1 . Wrap a message into a HTML5 document, return to a PSR-7 implementation
5460 ``` php
55- $document = (new \Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate())->getMarkup();
61+ $template = new \Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate();
62+ $template->setContent('<h1 >Status</h1 ><p >All Systems Operational</p >');
63+ return $template->getMarkup();
5664 ```
5765
58- 1 . Get template with custom content and write to file
66+ 1 . Wrap a message, use a preconfigured CSS framework CDN
67+ (see [ »options«] ( #options ) for a list of supported frameworks),
68+ and save the document into a file
5969 ``` php
6070 $template = new \Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate();
71+ $template->setStylesheet('skeleton');
6172 $template->setContent('<h1 >Index</h1 ><p >Nothing to see here</p >');
6273 file_put_contents('/var/www/example/index.html', $template->getMarkup());
6374 ```
6475
65- 1 . Get template with custom content, an external link to a CSS framework
66- output the document as response
76+ 1 . Wrap a message, set a custom stylesheet URL,
77+ set a title, output the document
6778 ``` php
6879 $template = new \Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate();
69- $template->setStylesheet('skeleton');
70- $template->setContent('<h1 >Status</h1 ><p >All Systems Operational</p >');
80+ $template->setStylesheet('/assets/styles.css');
81+ $template->setTitle('Index');
82+ $template->setContent('<h1 >TOC</h1 ><ul ><li >a</li ><li >b</li ></ul >');
7183 echo $template->getMarkup();
7284 ```
7385
86+ 1 . Get the example template only (👉 or use the [ Webapp] ( #webapp ) )
87+ ``` php
88+ echo \Pixelbrackets\Html5MiniTemplate\Html5MiniTemplate::getTemplate();
89+ ```
90+
7491### Options
7592
7693- ` setContent() ` the message to show, any HTML string to replace the main
@@ -90,9 +107,12 @@ https://gitlab.com/pixelbrackets/html5-mini-template/
90107- ` setTitle() ` the title is the first headline found in the document, unless
91108 it is overwritten with this option
92109- ` setAdditionalMetadata() ` any additional metadata like metatags or link
93- references, for example a canonical link to avoid duplicate content - Usage
94- of this option is an indicator that the given use case is too specific and
95- switching to a template engine should be considered
110+ references, for example a canonical link to avoid duplicate content
111+ - ⚠️ Usage of this option is an indicator that the given use case is too
112+ specific and switching to a template engine like the minimal
113+ [ slim/php-view] ( https://packagist.org/packages/slim/php-view ) or the
114+ powerfull [ twig/twig] ( https://packagist.org/packages/twig/twig )
115+ should be considered
96116
97117## License
98118
0 commit comments