PHP code example of skrip42 / twig-postprocessor-bundle

1. Go to this page and download the library: Download skrip42/twig-postprocessor-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/ */

    

skrip42 / twig-postprocessor-bundle example snippets


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);
  }
}