ivopetkov / html-server-components-compiler
HTML Server Components compiler
Fund package maintenance!
ivopetkov
www.paypal.me/ivopetkovcom
Installs: 3 774
Dependents: 2
Suggesters: 0
Security: 0
Stars: 9
Watchers: 3
Forks: 2
Open Issues: 0
Requires
- php: 7.0.*|7.1.*|7.2.*|7.3.*|7.4.*|8.0.*|8.1.*|8.2.*|8.3.*
- ivopetkov/html5-dom-document-php: ^2.5
Requires (Dev)
- ivopetkov/docs-generator: 0.1.*
This package is auto-updated.
Last update: 2024-10-20 05:51:21 UTC
README
A brand new way to build websites
It's a simple idea:
Instead of using template engines or PHP includes in your HTML code use the <component> tag. It allows you to:
- Include code from other files (
<component src="file:header.php"/>
). - Pass arguments (
<component src="file:content.php" pageID="home"/>
) that are available in the file ($component->getAttribute('pageID')
or just$component->pageID
). - Automatically places the included file HTML code into the proper places (Tags in the
head
go in the parent documenthead
). - Makes easy to test each component because each component outputs full HTML code.
Install via Composer
composer require ivopetkov/html-server-components-compiler
Usage
$compiler = new IvoPetkov\HTMLServerComponentsCompiler(); echo $compiler->process(' <html> <body> <component src="file:header.php"/> <component src="file:content.php" pageID="home"/> <component src="file:footer.php"/> </body> </html> ')
Documentation
Full documentation is available as part of this repository.
Demo
A demo is available at http://ivopetkov.github.io/demos/html-server-components/. The source is also there.
License
This project is licensed under the MIT License. See the license file for more information.
Contributing
Feel free to open new issues and contribute to the project. Let's make it awesome and let's do in a positive way.
Author
This library is created and maintained by Ivo Petkov (ivopetkov.com).