skrip42 / twig-postprocessor-bundle
Add postprocessor to twig
Installs: 14
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:symfony-bundle
Requires
- php: ^7.1
- ocramius/proxy-manager: ^2.0
- symfony/dependency-injection: ^4.1|^5.0
This package is auto-updated.
Last update: 2024-11-06 15:16:52 UTC
README
symphony bundle that adds post-processing functionality to your twig
install
composer require Skrip42/twig-postprocessor-bundle
usage
- create you own postprocessor that implements Skrip42\Bundle\TwigPostprocessorBundle\PostprocessorInterface
namespace App\Twig; use Skrip42\Bundle\TwigPostprocessorBundle\PostprocessorInterface; class YouOwnProcessor implements PostprocessorInterface { /** * @params string $content - raw html string * @params string $name - template name * @params array $context - array of template params * * @return string - modifyed html string */ public function postProcess( string $content, string $name, array $context ): string { return someChange($content); } }
- define you processo as twig postprocessor
App\Twig\YouOwnProcessor: tags:[twig.postprocessor]