Download the PHP package vdhicts/html-element without Composer
On this page you can find all versions of the php package vdhicts/html-element. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download vdhicts/html-element
More information about vdhicts/html-element
Files in vdhicts/html-element
Package html-element
Short Description Easily create HTML elements from PHP
License MIT
Informations about the package html-element
Html Element
This package allows you to easily create HTML elements from PHP. It's inspired by David Walsh's blogpost but further improved.
Requirements
This package requires PHP 7.4 or higher.
Installation
You can install the package via composer:
Usage
A new html element can be created with:
The element could contain text:
The element could have one or more attributes:
Or the element could contain another html element:
The text and attributes can also be added, which merges with existing text or attributes.
Methods
getTag
orsetTag
to request or change the tag.getAttributes
orgetAttribute(attribute)
to retrieve all attributes with their values or one attributes with its valuesetAttributes
orsetAttribute(attribute, value)
to manipulate all attributes or just one.addAttributeValue
adds a value to an attributes.removeAttributes
orremoveAttribute(attribute)
to remove all attributes or just one.removeAttributeValue(attribute, value)
to remove one value from a attribute.getText
,addText
orsetText
to retrieve, add or set the inner text.inject
to inject a Element into the current Element.generate
generates the Element and returns its string representation.output
echos the result ofgenerate
.
Tests
Unit tests are available in the tests
folder. Run with:
composer test
When you want a code coverage report which will be generated in the build/report
folder. Run with:
composer test-coverage
Contribution
Any contribution is welcome, but it should meet the PSR-12 standard and please create one pull request per feature/bug. In exchange, you will be credited as contributor on this page.
Security
If you discover any security related issues in this or other packages of Vdhicts, please email [email protected] instead of using the issue tracker.
Support
If you encounter a problem with this parser or has a question about it, feel free to open an issue on GitHub.
License
This package is open-sourced software licensed under the MIT license.
About Vdhicts
Vdhicts is the name of my personal company for which I work as freelancer. Vdhicts develops and implements IT solutions for businesses and educational institutions.