PHP code example of inteve / latte

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

    

inteve / latte example snippets


\Inteve\Latte\ExtensionInstaller::install($latte, [
	new \Inteve\Latte\IconExtension($phigIcons),
]);

\Inteve\Latte\ExtensionInstaller::install($latte, [
	new \Inteve\Latte\TypographyExtension,
]);

class MyExtension extends \Inteve\Latte\Extension
{
	/**
	 * @return array<callable(\Latte\Compiler):void>
	 */
	public function getTags(): array
	{
		return [
			function (\Latte\Compiler $compiler) {
				$me = new Latte\Macros\MacroSet($compiler);
				$me->addMacro('myTag', ['MyLatteMacros', 'macroMyTag']);
			},
		];
	}


	/**
	 * @return array<string, callable>
	 */
	public function getFilters(): array
	{
		return [
			'myFilter' => function ($value) {
				return $value,
			},
		];
	}


	/**
	 * @return array<string, mixed>
	 */
	public function getProviders(): array
	{
		return [
			'myProvider' => 'foo bar',
		];
	}
}
 php
\Inteve\Latte\ExtensionInstaller::install($latte, [
	new FooExtension,
	new BarExtension,
]);