AsapoTidyBundle
PHP-Tidy wrapper Bundle for Symfony 2 Projects
Why use this Bundle?
This Bundle uses tidy-php to clean and repair responses automatically.
What tidy is?
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.
Installation
Development version
php composer.phar require asapo/tidy-bundle:dev-developCurrent Release
php composer.phar require asapo/tidy-bundle:0.1.*Configuration
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
Try it?
You have two possibilities to trigger tidy bundle.
Service
/** @var TidyWrapperInterface $asapoTidy */
$asapoTidy = $this->get('tidy');
$clean = $asapoTidy->cleanUp($dirty, 'your_alias');Automatically with reponse listener
return $this->render('AcmeDemoBundle:Welcome:index.html.twig', array(), new TidyResponse('your_alias'));or
return new TidyResponse('your_alias', $dirty);Profiler
If the data collector is enabled error or warnings can be displayed over the symfony2 profiler.
Toolbar
(green icon on the far right)


