New

Just launched: Vueblocks, a brand-new search engine for Vue packages! Explore Vueblocks →

stillat/statamic-template-resolver

6,161

Larablocks Analysis

stillat/statamic-template-resolver works with Laravel 12 and 13 (latest release v1.2.0, Sep 25, 2025).

Recommendation checks

Use with care

Use with care: meets 1 of 4 checks.

  • Works with Laravel 13, the current version
  • No release in the last 12 months (last: Sep 25, 2025)
  • 110 downloads a month (needs 10,000)
  • 0 GitHub stars (needs 100)

State

Quiet
  • Last stable release: Sep 25, 2025.
  • No releases in the last 12 months.
  • First released: Nov 4, 2023.
  • Monthly downloads: 110.
  • 0 open issues on GitHub.

Data from Packagist and GitHub, checked by Larablocks on Nov 27, 2026.

Install
composer require stillat/statamic-template-resolver
Latest Version:v1.2.0
PHP:^8.0
Laravel:12 · 13
License:MIT
Last Updated:Sep 25, 2025
Links: GitHub  ·  Packagist
Maintainer: stillat

Template Resolver for Statamic

Template Resolver for Statamic is a simple utility addon, intended to be used by other addons. It provides a simple utility for selecting and rendering a template based on an entry's blueprint and collection, with support for a fallback default template.

Example use-cases:

  • Selecting templates dynamically to generate social media images from HTML,
  • Generating HTML documents on-the-fly, without requiring network requests to the site,
  • Anything where you need to support customizable templates based on an entry's blueprint/collection details

How to Install

Run the following command from your project root:

composer require stillat/statamic-template-resolver

How to Use

You need to create an instance of StringTemplateManager, and supply the directory to search for templates in.

<?php

use Stillat\StatamicTemplateResolver\StringTemplateManager;

$manager = new StringTemplateManager(
    resource_path('views/social_media_images')
);

Once you have a StringTemplateManager instance, you can check if a template exists for a given collection/blueprint combination:

<?php

// ...

if ($manager->hasTemplate($collection, $blueprint)) {
    // The template exists.
}

The hasTemplate method will return true if a specific template or the default template exists. To create a default template, create a file named _default.antlers.html or _default.blade.php at the root of the template folder.

In our example, the default template would need to be placed here:

views/social_media_images/_default.antlers.html

Specific collection/blueprint templates are stored within a nested directory structure using the following format:

<template_directory><collection_handle>/<blueprint_handle>.<extension>

For example, if we had a blog collection, with a post blueprint, we could create a specific template at the following location:

views/social_media_images/blog/post.antlers.html

This library supports the following extensions:

  • .antlers.html: Renders the template using Statamic's Antlers templating engine
  • .blade.php: Renders the template using Laravel's Blade templating engine

To render a template with data, we may use the render method:

<?php

// ...

$results = $manager->render(
    'colllection_handle',
    'blueprint_handle',
    $data
);

The render method will return null if a template could not be found; $data is provided as an array, and is required.

We may also optionally modify the template before rendering it by supplying an optional callable as the fourth argument:

<?php

// Modify the template before its rendered.
$results = $manager->render(
    'collection_handle',
    'blueprint_handle',
    $data,
    function ($template, $data) {
        return mb_strtoupper($template);
    }
);

The modifying callable will receive the unmodified template contents as its first argument, and the original data array as the second.

License

Statamic Template Resolver is free software, released under the MIT license.

Related Packages

doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database s...

670,032,257 9,703
laravel/framework

The Laravel Framework.

640,572,096 35,338
laravel/tinker

Powerful REPL for the Laravel framework.

546,909,908 7,440
laravel/serializable-closure

Laravel Serializable Closure provides an easy and secure way to serialize closur...

465,816,364 607
nunomaduro/collision

Cli error handling for console/command-line PHP applications.

431,187,642 4,660

Version History

Version Released PHP License
v1.2.0 ^8.0 MIT
v1.1.0 ^8.0 MIT
v1.0.2 ^8.0 MIT
v1.0.1 ^8.0 MIT
v1.0.0 ^8.0