asapo/tidy-bundle

PHP-Tidy wrapper Bundle for Symfony 2 Projects

Installs: 9 439

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 4

Forks: 0

Open Issues: 3

Language:CSS

Type:tidy-bundle

0.1.0 2014-08-09 22:15 UTC

This package is auto-updated.

Last update: 2024-11-25 06:56:02 UTC


README

PHP-Tidy wrapper Bundle for Symfony 2 Projects

Scrutinizer Code Quality

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.

Source ...

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

image

(green icon on the far right)

Panel

image