AsapoTidyBundle
PHP-Tidy wrapper Bundle for Symfony 2 Projects, (*1)
, (*2)
Why use this Bundle?
This Bundle uses tidy-php to clean and repair responses automatically., (*3)
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., (*4)
Source ..., (*5)
Installation
Development version, (*6)
php composer.phar require asapo/tidy-bundle:dev-develop
Current Release, (*7)
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., (*8)
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, (*9)
return new TidyResponse('your_alias', $dirty);
Profiler
If the data collector is enabled error or warnings can be displayed over the symfony2 profiler., (*10)
, (*11)
(green icon on the far right), (*12)
Panel
, (*13)