PHPackages                             bigboxwc/wp-template-loader - 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. bigboxwc/wp-template-loader

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

bigboxwc/wp-template-loader
===========================

WordPress view/template loading helpers.

1.0.2(7y ago)1264GPL-2.0-or-laterPHP

Since Jun 15Pushed 7y ago1 watchersCompare

[ Source](https://github.com/bigboxwc/wp-template-loader)[ Packagist](https://packagist.org/packages/bigboxwc/wp-template-loader)[ RSS](/packages/bigboxwc-wp-template-loader/feed)WikiDiscussions master Synced 4d ago

READMEChangelog (3)DependenciesVersions (4)Used By (0)

BigBox Template Loader Component
================================

[](#bigbox-template-loader-component)

Add sanity to WordPress templating systems.

Table Of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Basic Usage](#basic-usage)
- [Contributing](#contributing)

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

[](#installation)

The best way to use this component is through Composer:

```
composer require bigboxwc/wp-template-loader
```

Basic Usage
-----------

[](#basic-usage)

Initializing the core template filtering should happen during runtime. This will route WordPress's core template files ([template hierarchy](https://developer.wordpress.org/themes/basics/template-hierarchy/) to your chosen layout directory (`/resources/views/layout`) by default.

```
( new \BigBoxWC\WP_Template_Loader\Loader() )::watch();
```

Instead of loading `/single.php`, `/resources/views/layout/single.php` is loaded instead.

### Defining Custom Directories

[](#defining-custom-directories)

The default view directory is `/resources/views` with a `layout` and `partials` directory relative to that. To change these pass them to the `Loader` instantiation.

```
( new \BigBoxWC\WP_Template_Loader\Loader( [
	'base_path'    => 'resources/templates',
	'layout_dir'   => 'wp-pages',
	'partials_dir' => 'parts',
] ) )::watch();
```

### Loading Views Manually

[](#loading-views-manually)

The `Loader` class also offers the ability to load views without using the WordPress' template loading system. These can easily be plugged in to any existing template helpers your theme may already be using.

#### Render a View

[](#render-a-view)

```
\BigBoxWC\WP_Template_Loader\Loader::view( 'my-view' );
```

Will output the contents of `resources/views/my-view.php`

#### Get a View

[](#get-a-view)

```
$view = \BigBoxWC\WP_Template_Loader\Loader::get_view( 'my-view' );
```

Will assign the contents of `resources/views/my-view.php` to a variable.

#### Render a View in a Custom Directory

[](#render-a-view-in-a-custom-directory)

```
\BigBoxWC\WP_Template_Loader\Loader::view( 'global/header' );
```

Will output the contents of `resources/views/global/header.php`

#### Render a View with Passed Variables

[](#render-a-view-with-passed-variables)

```
\BigBoxWC\WP_Template_Loader\Loader::view( 'global/header', [
	'min' => true,
] );
```

Will output the contents of `resources/views/global/header.php` with the variable `$min` available in the global scope.

#### Render a Partial

[](#render-a-partial)

The above methods can be repeated with the `partial()` method instead of `view()` to automatically look in the set `$partial_dir` location.

Contributing
------------

[](#contributing)

All feedback / bug reports / pull requests are welcome.

License
-------

[](#license)

This code is released under the GPL license.

For the full copyright and license information, please view the [`LICENSE`](LICENSE) file distributed with this source code.

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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 ~0 days

Total

3

Last Release

2891d ago

### Community

Maintainers

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

---

Top Contributors

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

---

Tags

wordpresswordpress-development

### Embed Badge

![Health badge](/badges/bigboxwc-wp-template-loader/health.svg)

```
[![Health](https://phpackages.com/badges/bigboxwc-wp-template-loader/health.svg)](https://phpackages.com/packages/bigboxwc-wp-template-loader)
```

###  Alternatives

[mustache/mustache

A Mustache implementation in PHP.

3.3k44.6M291](/packages/mustache-mustache)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[whitecube/nova-flexible-content

Flexible Content &amp; Repeater Fields for Laravel Nova.

8053.0M25](/packages/whitecube-nova-flexible-content)[mopa/bootstrap-bundle

Easy integration of twitters bootstrap into symfony2

7042.9M33](/packages/mopa-bootstrap-bundle)[limenius/react-bundle

Client and Server-side react rendering in a Symfony Bundle

3871.2M](/packages/limenius-react-bundle)[nicmart/string-template

StringTemplate is a very simple string template engine for php. I've written it to have a thing like sprintf, but with named and nested substutions.

2101.7M30](/packages/nicmart-string-template)

PHPackages © 2026

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