PHP code example of setono / twig-cache-purger-bundle
1. Go to this page and download the library: Download setono/twig-cache-purger-bundle library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
setono / twig-cache-purger-bundle example snippets
Setono\TwigCachePurgerBundle\SetonoTwigCachePurgerBundle::class => ['all' => true],
use Setono\TwigCachePurgerBundle\Purger\PurgerInterface;
final class YourService
{
public function __construct(private readonly PurgerInterface $purger)
{
}
public function updateTemplate(): void
{
// Purge the cached compiled version of a specific template
$this->purger->purge('emails/welcome.html.twig');
}
}