Download the PHP package lab1521/neaty-html without Composer
On this page you can find all versions of the php package lab1521/neaty-html. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download lab1521/neaty-html
More information about lab1521/neaty-html
Files in lab1521/neaty-html
Package neaty-html
Short Description Cleans up HTML markup with Tidy
License MIT
Homepage https://github.com/lab1521/NeatyHTML
Informations about the package neaty-html
NeatyHTML
Cleans up your HTML. Useful for writing content or blogs that accepts HTML markup. Requires the PHP tidy class. Please install this extension first.
Accepting HTML contents (with markups/tags included etc.) on your website is somewhat a concern regarding the security of your website and its users. The dreaded XSS or Cross Site Scripting is always a threat. However with the power of open source we can keep up with common threats and mitigate the issues for safekeeping our websites or blogs.
Installation
How to use
Limitations
Current PHP's DomDocument class does not support HTML5 tags/attributes. For this reason a NeatyDOMException exception is thrown.
Laravel Specific Usage
Service provider
For your Laravel app, open config/app.php and, within the providers array, append:
Using Facades
Add a new item in the 'aliases' array on the same file, config/app.php
Example Usage
Custom Validation Rule
NeatyHTML provides a custom validation rule called 'html' which will check your POST input containing markups and passes the error message when validation fails. Please note that NeatyHTMLServiceProvider is deferred by default so we need to inject this class in the controller method in order to use the custom validation feature. In this way we only use NeatyHTML when we wanted which is nice to have.