PHPackages                             pine3ree/pine3ree-plates-resolvers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Templating &amp; Views](/categories/templating)
4. /
5. pine3ree/pine3ree-plates-resolvers

ActiveLibrary[Templating &amp; Views](/categories/templating)

pine3ree/pine3ree-plates-resolvers
==================================

Custom template resolvers for the Plates engine

1.1.0(1y ago)09BSD-3-ClausePHPPHP ^7.4 || ^8.0CI passing

Since Oct 1Pushed 1y ago1 watchersCompare

[ Source](https://github.com/pine3ree/pine3ree-plates-resolvers)[ Packagist](https://packagist.org/packages/pine3ree/pine3ree-plates-resolvers)[ Docs](https://github.com/pine3ree/pine3ree-plates-resolvers)[ RSS](/packages/pine3ree-pine3ree-plates-resolvers/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (3)Dependencies (8)Versions (4)Used By (0)

pine3ree-plates-resolvers
=========================

[](#pine3ree-plates-resolvers)

This package provides a couple of template resolvers with cache support for the Plates engine:

- `NameAndFolderResolveTemplatePath` is the same default Plates resolver, but with cache enabled
- `ReverseFallbackResolveTemplatePath` is a resolver that works in the opposite way: first, if defined, the global template directory is searched and then the template folder is searched

### Install

[](#install)

This package requires `PHP 7.4 ~ 8.4`. You can install it via composer:

```
$ composer require pine3ree/pine3ree-plates-resolvers
```

### NameAndFolderResolveTemplatePath

[](#nameandfolderresolvetemplatepath)

Works the same way as the default Plates template-path resolver, but with added cache support for resolved templates.

The internal cache stores and returns by name those template paths that have already been positively resolved, thus avoiding calling `$name->getPath()`repeatedly on the same template. The internal cache is enabled including the `CacheableResolveTemplatePathTrait trait` in this package implementing methods of the `CacheableResolveTemplatePathInterface`

This is useful in cases when you use partials like sorting-table-headers links or multiple paginators several times on the same page. At the same time it also provides long term caching for async environments like `Swoole`

### ReverseFallbackResolveTemplatePath

[](#reversefallbackresolvetemplatepath)

This resolver acts in the opposite way of the default plates resolver

When a template is rendered with a folder specification (Plates `::` notation), the search starts at the default template directory (if defined) but with an added sub-folder matching the folder specification, e.g.:

```
$template->render('partials::pagination', $vars);

// The search order is:
//
// 1. {/path/to/the/default/templates/directory/}partials/pagination.phtml
// 2. {/path/to/the/partials/template/folder/}pagination.phtml
```

Furthermore, when a template name is provided without a folder specification but contains the path separator "/", then a folder will be assigned using the first segment. Therefore the previous example applies also for the following simpler render call:

```
$template->render('partials/pagination', $vars);
```

In both cases the "partial" folder must have been defined in the engine's configuration.

This can be useful in modular application, where we want each module templates to be close to the source code. In those cases we set a folder for each module template. When we reuse the same module in other applications it will works right away. Then, we will use the default "application" templates directory t0 customize/override the default templates provided by each module.

Example:

Given the following application directory structure

```

/path/to/my/web/app/
    templates/ addFolder('shop', '/path/to/my/web/app/Shop/templates');

// This will load the template in the global templates directory, because a
// matching template-file is found
$plates->render("news::article/read", $vars); // or simply
$plates->render("news/article/read", $vars);

// This will load the template in the module templates directory, because there
// is no matching file in the global directory
$plates->render("shop::product/index", $vars); // or simply
$plates->render("shop/product/index", $vars);
```

The url-path "/" segment notation is recommended since it shows the template path relative to the global templates directory, while the standard folder notation could trick into believeing that global directory templates are not being used.

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance51

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~288 days

Total

3

Last Release

374d ago

PHP version history (2 changes)1.0.0PHP ^7.4 || ^8.0 || ^8.1 || ^8.2

1.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/ba4cd94c187112c16f80f5785a3cdf3703b6f6b578f27c3a0a1bb9b9b0c1ce43?d=identicon)[pine3ree](/maintainers/pine3ree)

---

Top Contributors

[![pine3ree](https://avatars.githubusercontent.com/u/3229979?v=4)](https://github.com/pine3ree "pine3ree (43 commits)")

---

Tags

templateextensionresolverplatespine3ree

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pine3ree-pine3ree-plates-resolvers/health.svg)

```
[![Health](https://phpackages.com/badges/pine3ree-pine3ree-plates-resolvers/health.svg)](https://phpackages.com/packages/pine3ree-pine3ree-plates-resolvers)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
