PHP code example of ssitu / nietzsche

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

    

ssitu / nietzsche example snippets


use SSITU\Nietzsche\Nietzsche;


# optional:
$Nietzsche->setLogger($somePsr3Logger);
# alternatively, you can retrieve logs that way:
$Nietzsche->getLocalLogs();
// if no logger set: returns all logs history;
// else: only last entry


$v_ = ["planet"=>"world"]; #could also be an object, as specified by Mustache doc
$viewName = "hello";
$viewDir = "path/to/views/";
$mustacheOpts = []; # cf. Mustache doc

// will either render your template, 
// or false if something went wrong --like a missing variable
$Nietzsche->renderPerfectMustache($v_, $viewName, $viewDir, $mustacheOpts);