PHP code example of pug-php / pug-phalcon

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

    

pug-php / pug-phalcon example snippets




// ...
$di = new FactoryDefault();

// Setting up the view component
$di['view'] = function() {
    $view = new View();
    $view->setViewsDir('../app/views/');
    $view->registerEngines(array(
        ".pug" => function($view, $di) {
            return new \Phalcon\Mvc\View\Engine\Pug($view, $di, array(
                'cache' => '/tmp/myproject/pug',
                'prettyprint' => APP_ENV == 'development',
            ));
        }
    ));

    return $view;
};
json
"pug-php/pug-phalcon": "^1.0"