Download the PHP package originphp/html without Composer
On this page you can find all versions of the php package originphp/html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download originphp/html
More information about originphp/html
Files in originphp/html
Package html
Short Description OriginPHP Html
License MIT
Homepage https://www.originphp.com
Informations about the package html
Html
The Html class provides some useful functions for when working with HTML.
Installation
To install this package
Then add to your file
From Text
If you need to convert a text block to html
This will create:
If want paragraphs to be wrapped with a different tag than p
then would do so like this
To Text
You can also convert a HTML string to formatted text
For example
Will output
To create text version without formatting:
The main difference is headings, tables, code etc are not formatted. The HTML is cleaned up, line breaks are added, and lists are converted. If a list has a sublist then indentation will be added.
Minify
Minify cleans up the spacing, removes comments and thus minifies a HTML string.
The following options are supported
- collapseWhitespace: default:true. Collapse whitespace in the text nodes
- conservativeCollapse: default:false. Always collapse whitespace to at least 1 space
- collapseInlineTagWhitespace: default:false. Don't leave any spaces between inline elements.
- minifyJs: default:false minifies inline Javascript (beta)
- minifyCss: default:false minifies inline CSS (beta)
Sanitize
Sanitize enables to only allow certain tags and attributes in a HTML string.
Strip Tags
To strip selected tags and their content from a HTML string, in other words strip tags that are in a blacklist
Escape
It is important when displaying user inputted HTML that it is escaped properly for security reasons, see Cross-site scripting for more information.