$macros
$macros : array
The registered string macros.
$debugFormatter : \Phug\Formatter
$compiler : \Phug\Compiler
The current compiler in use to convert Pug code into PHP code.
hasModule(string|\Phug\Util\ModuleInterface $module) : boolean
string|\Phug\Util\ModuleInterface | $module |
getModule(string|\Phug\Util\ModuleInterface $module) : \Phug\Util\ModuleInterface
string|\Phug\Util\ModuleInterface | $module |
addModule(string|\Phug\Util\ModuleInterface $module) : $this
string|\Phug\Util\ModuleInterface | $module |
removeModule(string|\Phug\Util\ModuleInterface $module) : $this
string|\Phug\Util\ModuleInterface | $module |
getDebugFormatter() : \Phug\Formatter
handleError(\Throwable $error, integer $code, string $path, string $source, array $parameters, array $options)
Handle error occurred in compiled PHP.
\Throwable | $error | |
integer | $code | |
string | $path | |
string | $source | |
array | $parameters | |
array | $options |
share(array|string $variables, mixed $value = null) : $this
Share variables (local templates parameters) with all future templates rendered.
array|string | $variables | a variables name-value pairs or a single variable name |
mixed | $value | the variable value if the first argument given is a string |
** File not found : $renderer->share('lang', **
** File not found : $renderer->share(['title' **
cacheFileIfChanged(string $path) : boolean|integer
Cache a template file in the cache directory if the cache is obsolete.
Returns true if the cache is up to date and cache not change, else returns the number of bytes written in the cache file or false if a failure occurred.
string | $path |
cacheDirectory(string|array<mixed,string> $directory) : array
Cache all templates in a directory in the cache directory you specified with the cache_dir option.
You should call after deploying your application in production to avoid a slower page loading for the first user.
string|array<mixed,string> | $directory |
getCompiler() : \Phug\CompilerInterface
Get the current compiler in use. The compiler class name can be changed with compiler_class_name option and is Phug\Compiler by default.
render(string $string, array $parameters = array(), string $filename = null) : string
Render a pug template string into a HTML/XML string (or any tag templates if you use a custom format).
string | $string | pug input string |
array | $parameters | parameters (values for variables used in the template) |
string | $filename | optional file path of the given template |
renderFile(string $path, string|array $parameters = array()) : string
Render a pug template file into a HTML/XML string (or any tag templates if you use a custom format).
string | $path | pug input file |
string|array | $parameters | parameters (values for variables used in the template) |
renderAndWriteFile(string $inputFile, string $outputFile, array $parameters = array()) : boolean
Render a pug file and dump it into a file.
Return true if the render and the writing succeeded.
string | $inputFile | input file (Pug file) |
string | $outputFile | output file (typically the HTML/XML file) |
array | $parameters | local variables |
renderDirectory(string $path, string $destination = null, string $extension = '.html', string|array $parameters = array()) : array
Render all pug template files in an input directory and output in an other or the same directory.
Return an array with success count and error count.
string | $path | pug input directory containing pug files |
string | $destination | pug output directory (optional) |
string | $extension | file extension (optional, .html by default) |
string|array | $parameters | parameters (values for variables used in the template) (optional) |
display(string $string, array $parameters = array(), string $filename = null)
Display a pug template string into a HTML/XML string (or any tag templates if you use a custom format).
string | $string | pug input string |
array | $parameters | parameters or file name |
string | $filename |
displayFile(string $path, array $parameters = array())
Display a pug template file into a HTML/XML string (or any tag templates if you use a custom format).
string | $path | pug input file |
array | $parameters | parameters (values for variables used in the template) |
setDebugFormatter(\Phug\Formatter $debugFormatter)
\Phug\Formatter | $debugFormatter |
initDebugOptions(\Phug\Renderer $profilerContainer)
\Phug\Renderer | $profilerContainer |
enableModule( $moduleClassName, $className, \Phug\Util\ModuleContainerInterface $container, $optionName)
$moduleClassName | ||
$className | ||
\Phug\Util\ModuleContainerInterface | $container | |
$optionName |
getErrorMessage( $error, \Phug\Util\SourceLocation $location, $data)
$error | ||
\Phug\Util\SourceLocation | $location | |
$data |
getCacheAdapter() : \Phug\Renderer\CacheInterface