PHP code example of orbis-labs / pug-symfony

1. Go to this page and download the library: Download orbis-labs/pug-symfony 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/ */

    

orbis-labs / pug-symfony example snippets


$services = $kernel->getContainer();
$pug = $services->get('templating.engine.pug');
$pug->setOptions(array(
  'pretty' => true,
  'pugjs' => true,
  // ...
));
// You can get the Pug engine to call any method available in pug-php
$pug->getEngine()->share('globalVar', 'foo');
$pug->getEngine()->addKeyword('customKeyword', $bar);

/**
 * @Route("/contact")
 */
public function contactAction()
{
    return $this->render('contact/contact.html.pug', [
        'name' => 'Bob',
    ]);
}

public function registerBundles()
{
    $bundles = [
        ...
        new PugBundle\PugBundle(),
    ];
 bin/console assets:publish --env=prod