PHPackages                             somehow-digital/craft-stack - 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. somehow-digital/craft-stack

ActiveCraft-plugin[Templating &amp; Views](/categories/templating)

somehow-digital/craft-stack
===========================

Brings a namespace system to better organize and load Twig templates in Craft CMS.

v1.0.0(1mo ago)10MITPHPPHP ^8.2

Since Mar 27Pushed 1mo agoCompare

[ Source](https://github.com/somehow-digital/craft-stack)[ Packagist](https://packagist.org/packages/somehow-digital/craft-stack)[ Docs](https://somehow.digital/)[ RSS](/packages/somehow-digital-craft-stack/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (2)Used By (0)

`Stack` for Craft CMS
=====================

[](#stack-for-craft-cms)

> Brings a namespace system to better organize and load [Twig](https://twig.symfony.com/) templates in [Craft CMS](https://craftcms.com/).

`Stack` provides a namespace system to resolve template files and behaves similar to how Twig's native [FilesystemLoader](https://twig.symfony.com/doc/3.x/api.html#twig-loader-filesystemloader) works. Under the hood it uses Craft's [Template Roots](https://craftcms.com/docs/5.x/extend/template-roots.html) mechanism. Currently, this plugin works in frontend mode only. (It does not work with Craft's panel templates.)

Requirements
------------

[](#requirements)

- Craft CMS 5.8.0 or later.
- PHP 8.2 or later.

Installation
------------

[](#installation)

Install this plugin from the Plugin Store or via Composer.

#### Plugin Store

[](#plugin-store)

Go to the “Plugin Store” in your project’s Control Panel, search for “stack” and click on the “Install” button in its modal window.

#### Composer

[](#composer)

```
composer require somehow-digital/craft-stack
./craft plugin/install stack
```

Configuration
-------------

[](#configuration)

Namespaces can be configured via a `config/stack.php` config file.

- By default no namespaces are configured and the plugin will not resolve templates.
- The order of configured namespaces matters when template files are resolved via `Dynamic Resolution`.
- `handle` and `path` values are object templates, where `Site` and `SiteGroup` objects are available to use.

**config/stack.php**

```
