symplify/modular-latte-filters

This package is abandoned and no longer maintained. The author suggests using the contributte/latte package instead.

Nette extension for modular Latte filters loading.

v2.0.0-RC3 2017-04-14 20:23 UTC

This package is auto-updated.

Last update: 2022-03-08 10:48:50 UTC


README

Build Status Downloads

Install

composer require symplify/modular-latte-filters

Register the extension:

# app/config/config.neon
extensions:
	- Symplify\ModularLatteFilters\DI\ModularLatteFiltersExtension

Usage

Create class implementing Symplify\ModularLatteFilters\DI\FiltersProviderInterface:

namespace App\Modules\SomeModule\Latte;

use Symplify\ModularLatteFilters\DI\FiltersProviderInterface;


final class SomeFilters implements FiltersProviderInterface
{

	public function getFilters() : array
	{
		return [
			'double' => function ($value) {
				return $value * 2;
			}
		];
	}

}

Register it to config.neon:

# app/config/config.neon
services:
	- App\Modules\SomeModule\Latte\SomeFilters

Use in any template:

{* app/templates/Homepage/default.latte *}

And your self-esteem is {$selfEsteem|double}

That's it!

Contributing

Send issue or pull-request to main repository.