PHP-Tidy wrapper Bundle for Symfony 2 Projects
This Bundle uses tidy-php to clean and repair responses automatically.
Tidy is a binding for the Tidy HTML clean and repair utility which allows you to clean, manipulate HTML documents and traverse the document tree.
Development version
php composer.phar require asapo/tidy-bundle:dev-develop
Current Release
php composer.phar require asapo/tidy-bundle:0.1.*
asapo_tidy:
config: []
encoding: utf8
response_listener: true
data_collector: true
- config: tidy-php configuration see here ...
- encoding: change encoding of parser
- response_listener: enable or disable reponse listener (cleanup automatically reponses)
- data_collector: enable or disable data collector to see tidy warnings / errors in profiler
You have two possibilities to trigger tidy bundle.
/** @var TidyWrapperInterface $asapoTidy */
$asapoTidy = $this->get('tidy');
$clean = $asapoTidy->cleanUp($dirty, 'your_alias');
return $this->render('AcmeDemoBundle:Welcome:index.html.twig', array(), new TidyResponse('your_alias'));
or
return new TidyResponse('your_alias', $dirty);
If the data collector is enabled error or warnings can be displayed over the symfony2 profiler.
(green icon on the far right)