Download the PHP package zisunal/php-html without Composer
On this page you can find all versions of the php package zisunal/php-html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download zisunal/php-html
More information about zisunal/php-html
Files in zisunal/php-html
Package php-html
Short Description A package to render html directly from php
License MIT
Informations about the package php-html
🈚 Want to customize your
HTML output from 🐘 PHP?
- Don't need continuous
?>and<?phpanymore. - Use a more intuitive syntax for HTML generation.
- Create 🌀
reusable components🌀 easily with PHP. - Enjoy better code organization and readability.
- Use
Flutter-likewidget structure for your HTML. - Use
Zisunal\PhpHtmlto create your HTML output with ease. - Use with
Vanilla PHPor anyPHP frameworkfreely.
📑 See Some Examples
Custom Navigation Menu
Custom Template
-
A Custom HTML with Organized Widget Tree like Flutter
1. Let's Start with Installing Zisunal\PhpHtml
2. If you are not using frameworks like Laravel / Symfony / CodeIgniter, you need to include the autoloader in your project root:
3. Use Zisunal\PhpHtml\Html to Start:
4. For Static Html Methods, use Zisunal\PhpHtml\Htm instead:
Note:
- This first one is
Htmland the second one isHtm. - No ending
lin the second one. -
Htmcan be used to create static HTML elements without the need for an instance. - Most of the methods of
Htmlare also available inHtm, so you can use them interchangeably. -
You can create an instance of
Htmllike this: -
If you add any of the templating methods with a
Html, it will render a complete HTML document. -
If you only add the tags' methods for the body, it will only render the content as a component.
-
If you want
single divinstead ofdivOpenanddivClosein the previous code, -
If you want the
shorter versionof the previous code, - If you want the previous code with
only static methods,
5. The Most Important info to know:
- You can call
render()method at the end of anyHtmlorHtmchain to get/print the final output. Remember, once you calledrender(), you can't add any more elements to the chain. - You can pass
trueas an argument torender()method to get the output as a string instead of printing it directly. -
You can minify the whole Html, CSS, JS output by calling
minify()method anywhere beforerender(). -
The following static and non-static methods are equivalent (assuming
$html = new Html()). So, you can use any of them interchangeably:$html->hr=>$html->hr()=>Html::hr()=>Htm::hr()$html->br=>$html->br()=>Html::br()=>Htm::br()-
$html->wbr=>$html->wbr()=>Html::wbr()=>Htm::wbr()
- We will say📝
Single Tagsto refer toself-closing tagslike<br />,<hr />,<wbr />from now on. -
We will say📝
Double Tagsto refer toopening and closing tagslike<div>,<h1>,<p>,<span>from now on. -
All the
Double Tagshave 2 methods:tagnameOpen()andtagnameClose().divOpen()anddivClose()for<div>tags.h1Open()andh1Close()for<h1>tags.pOpen()andpClose()for<p>tags.spanOpen()andspanClose()for<span>tags.aOpen()andaClose()for<a>tags.- And so on for all other double tags.
- Any other
Html tagor aninnerText()method can be called insideDouble Tagto customize the content as needed.
- All the
Single Tagscan be called directly without any Open and Close methods. It will accept attributes as an array. - Some
Single Tagscan also accept their required contents as arguments before the attributes array. - Some
Double Tagscan also accept their contents as arguments before the attributes array.
📖 Methods Available to use:
- You can find the complete list of methods and documentations for
Htmlhere -
You can find the complete list of methods and documentations for
Htmhere❓ FAQ
Q: What is the difference between
HtmlandHtm?A:
Htmlis the main class for generating HTML content, whileHtmis a lightweight version that focuses on generating HTML snippets without the full document structure.Q: Can I use
Htmmethods insideHtml?A: Yes, you can use
Htmmethods inside anyHtmlmethods as needed.
🔧 Adding more tags support
If you need any other standard Html tag support you can email me by clicking here
📝 Contributing
We welcome contributions to the Zisunal\PhpHtml package! If you'd like to contribute, please follow these steps:
-
Fork the repository: Create your own copy of the repository by forking it on GitHub.
-
Create a new branch: Before making changes, create a new branch for your feature or bug fix:
-
Make your changes: Implement your feature or fix the bug in your local copy of the repository.
-
Write tests: If applicable, write tests to cover your changes. Ensure that all tests pass before submitting your pull request.
-
Submit a pull request: Once you're satisfied with your changes, push your branch to your forked repository and submit a pull request to the main repository.
- Follow the code style: Please adhere to the existing code style and conventions used in the project.
Thank you for your contributions!
All versions of php-html with dependencies
wongyip/html-beautify Version ^1.1
cerdic/css-tidy Version ^2.2
matthiasmullie/minify Version ^1.3