imponeer/smarty-extensions-contracts

Interfaces for defining smarty template engine extensions in object way

v3.0.2 2023-10-01 11:37 UTC

README

License GitHub release Maintainability PHP Packagist

Smarty Extensions Contracts

Smarty 3 still doesn't use classes for define most of the possible extensions types. This library tries to fix that - it provides all needed interfaces to define extensions in object way.

Defining smarty extensions in object way also can be useful when working with containers. Smarty extensions that could be registered with tags and then loaded when needed.

Installation

To install and use this package, we recommend to use Composer:

composer require imponeer/smarty-extensions-contracts

Otherwise, you need to include manually files from src/ directory.

Mapping

Extension type Interface name What it for?
Template Function \Imponeer\Contracts\Smarty\Extension\SmartyFunctionInterface Interface that lets to define smarty function extension
Modifier \Imponeer\Contracts\Smarty\Extension\SmartyModifierInterface Interface that lets to define smarty function extension
Block Function \Imponeer\Contracts\Smarty\Extension\SmartyBlockInterface Extension interface for smarty block functions
Compiler Function \Imponeer\Contracts\Smarty\Extension\SmartyCompilerInterface Interface that lets to define smarty compiler extension (that is not internal function based)
Prefilter \Imponeer\Contracts\Smarty\Filter\SmartyPreFilterInterface Defines filter that is executed to process template source before compilation
Postfilter \Imponeer\Contracts\Smarty\Filter\SmartyPostFilterInterface Defines filter that is executed to process template source after compilation
Output filter \Imponeer\Contracts\Smarty\Filter\SmartyOutputFilterInterface Defines filter that is executed before template is loaded and executed but before displayed
Resource \Imponeer\Contracts\Smarty\Extension\SmartyResourceInterface Defines custom smarty resource type

How to contribute?

If you want to add some functionality or fix bugs, you can fork, change and create pull request. If you not sure how this works, try interactive GitHub tutorial.

If you found any bug or have some questions, use issues tab and write there your questions.