asapo / tidy-bundle
PHP-Tidy wrapper Bundle for Symfony 2 Projects
Installs: 9 071
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 4
Forks: 0
Open Issues: 3
Language:CSS
Type:tidy-bundle
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: 3.7.*
- symfony/monolog-bundle: 2.4.*
- symfony/symfony: 2.5.*
This package is auto-updated.
Last update: 2024-10-25 06:36:26 UTC
README
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-develop
Current 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)