Componette

Componette

deprecated-packages

deprecated-packages / ModularLatteFilters

[READ-ONLY] Nette extension for modular Latte filters

download-cloud-line composer require zenify/modular-latte-filters

Modular Latte Filters

Build Status Quality Score Code Coverage Downloads Latest stable

Install

composer require zenify/modular-latte-filters

Register the extension:

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

Usage

Create class implementing Zenify\ModularLatteFilters\DI\FiltersProviderInterface:

namespace App\Modules\SomeModule\Latte;

use Zenify\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!

Testing

composer check-cs
vendor/bin/phpunit

Contributing

Rules are simple:

  • new feature needs tests
  • all tests must pass
  • 1 feature per PR

We would be happy to merge your feature then!

No release at this moment. Try to create first one.

price-tag-2-line

Badges

guide-fill

Dependencies

php (^7.0)
nette/di (^2.4)
Componette Componette felix@nette.org