inteve/latte 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

inteve/latte

最新稳定版本:v1.1.0

Composer 安装命令:

composer require inteve/latte

包简介

Extensions for Latte templates

README 文档

README

Build Status Downloads this Month Latest Stable Version License

Extensions for Latte templates

Donate

Installation

Download a latest package or use Composer:

composer require inteve/latte

Inteve\Latte requires PHP 8.0 or later and Latte 2.

Usage

Installation of extensions

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

or via Nette DI extension:

extensions:
	inteve.latte: Inteve\Latte\DIExtension

services:
	- FooExtension
	- BarExtension

IconExtension

Creates new Latte tag {icon foo}. Saves icon code directly to compiled template. Requires implementation PHIG's HtmlIcons interface.

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

TypographyExtension

Creates new Latte filter |typography.

\Inteve\Latte\ExtensionInstaller::install($latte, [
	new \Inteve\Latte\TypographyExtension,
]);
{='My a text'|typography} {* prints 'My a text' *}

Custom extension

Just extends Inteve\Latte\Extension:

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',
		];
	}
}

License: New BSD License
Author: Jan Pecha, https://www.janpecha.cz/

统计信息

  • 总下载量: 9
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2023-12-08