2017 © Pedro Peláez
 

library groundskeeper

Groundskeeper will clean your weedy HTML.

image

kevintweber/groundskeeper

Groundskeeper will clean your weedy HTML.

  • Sunday, October 1, 2017
  • by kevintweber
  • Repository
  • 1 Watchers
  • 0 Stars
  • 62 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 7 % Grown

The README.md

Groundskeeper

Latest Version on Packagist ![Software License][ico-license] Build Status ![Coverage Status][ico-scrutinizer] Quality Score, (*1)

Groundskeeper will clean your weedy HTML., (*2)

Install

Via Composer, (*3)

``` bash $ composer require kevintweber/groundskeeper, (*4)


## Usage Here is a simple example: ``` php use Groundskeeper\Groundskeeper; $groundskeeper = new Groundskeeper(array( 'output' => 'pretty' )); $groundskeeper->setLogger($myLogger); // Optional: will log changes to your HTML. $cleanHtml = $groundskeeper->clean($dirtyHtml);

Options

  • clean-strategy: Describes how the HTML document will be cleaned.
    • Options: none, lenient, standard, aggressive; Default: standard
    • none - No cleaning will be done.
    • lenient - Like standard except no markup will be removed.
    • standard - Standard compliant HTML will be output. Unfixable malformed HTML will be removed.
    • aggressive - Like "standard" plus non-standard elements will be removed. (TODO)
  • element-blacklist: Describes which elements will be removed from the output.
    • Options: Comma seperated list of elements; Default: `` (empty list)
  • indent-spaces: The number of spaces for indentation when using pretty output.
    • Options: integer greater than or equal to 0; Default: 4
  • output: Describes how the HTML will be output.
    • Options: compact, pretty; Default: compact
    • compact - Will remove all whitespace between elements, and will set indent-spaces to 0.
    • pretty - One element per line with indentation. Handy for debugging.
  • type-blacklist: Describes which token types will be removed from the output.
    • Options: Comma seperated list of any of the following: cdata, comment, doctype, element, php, text; Default: cdata,comment

Todo

  1. Implement aggressive cleaning strategy.
  2. pretty output should inline certain elements.
  3. Add option to remove / sanitize all JS attributes.

Change log

Please see CHANGELOG for more information what has changed recently., (*5)

Testing

bash $ phpunit, (*6)

Contributing

Please see CONTRIBUTING for details., (*7)

Security

If you discover any security related issues, please email kevintweber@gmail.com instead of using the issue tracker., (*8)

Credits

License

The MIT License (MIT). Please see License File for more information., (*9)

The Versions

01/10 2017

dev-master

9999999-dev https://github.com/kevintweber/Groundskeeper

Groundskeeper will clean your weedy HTML.

  Sources   Download

MIT

The Requires

 

The Development Requires

by Kevin Weber

filter html sanitize kevintweber groundskeeper

12/03 2017

v0.2

0.2.0.0 https://github.com/kevintweber/Groundskeeper

Groundskeeper will clean your weedy HTML.

  Sources   Download

MIT

The Requires

 

by Kevin Weber

filter html sanitize kevintweber groundskeeper

28/05 2016

v0.1

0.1.0.0 https://github.com/kevintweber/Groundskeeper

Groundskeeper will clean your weedy HTML.

  Sources   Download

MIT

The Requires

 

by Kevin Weber

filter html sanitize kevintweber groundskeeper