PHP code example of evista / compress

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

    

evista / compress example snippets


echo $container->get('twig.templating')->render('index.twig.html', ['hehh' => 'Yeah!']);

$loader = new Twig_Loader_Filesystem('/path/to/templates');
$twig = new Twig_Environment($loader, array(
    'cache' => '/path/to/compilation_cache',
));

echo $twig->render('index.html', array('name' => 'Fabien'));

//wp-content/plugins/evista-composer/Composer.php
  
  
/**
     * Add service definitions here:
     *
     */
  public function setUpServices(){
      $this->services = [
          'twig.loader' =>[
              'class' => '\Twig_Loader_Filesystem',
              'arguments' => [__DIR__.'/views']
          ],
          'twig.templating' => [
              'class' => '\Twig_Environment',
              'arguments' => ['@twig.loader']
          ],
      ];
    }

$templating = $container->get('twig.templating');
$page = $templating->render('index.twig.html', ['hehh' => 'Yeah!']);

public function setUpServices(){
      $this->services = [
          'sample.service' =>[
              'class' => '\SampleService',
              'arguments' => ['string', '@other.service', ['first'=>'1', "second" => '2']]
          ],
          // ..
      ];
    }
 php
echo $container->get('twig.templating')->render('index.twig.html', ['hehh' => 'Yeah!']);