PHPackages                             cable8mm/stub-template - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. cable8mm/stub-template

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

cable8mm/stub-template
======================

The package is not a template engine, but you can use it like one to create stub files when needed.

v1.0.0(1y ago)04121MITPHPPHP ^8.1CI failing

Since Feb 11Pushed 1y ago1 watchersCompare

[ Source](https://github.com/cable8mm/stub-template)[ Packagist](https://packagist.org/packages/cable8mm/stub-template)[ Docs](https://github.com/cable8mm/stub-template)[ RSS](/packages/cable8mm-stub-template/feed)WikiDiscussions main Synced 1mo ago

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

Stub Template
=============

[](#stub-template)

[![Coding Style Actions](https://github.com/cable8mm/stub-template/actions/workflows/code-style.yml/badge.svg)](https://github.com/cable8mm/stub-template/actions/workflows/code-style.yml/badge.svg)[![Run Tests Actions](https://github.com/cable8mm/stub-template/actions/workflows/run-tests.yml/badge.svg)](https://github.com/cable8mm/stub-template/actions/workflows/run-tests.yml/badge.svg)[![Latest Version on Packagist](https://camo.githubusercontent.com/e6420aa43ceef630779e392b75343108a869c5af9a22b529e41ed34fb1e5a918/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6361626c65386d6d2f737475622d74656d706c6174652e737667)](https://packagist.org/packages/cable8mm/stub-template)[![Packagist Dependency Version](https://camo.githubusercontent.com/583a692a862906f58b81520b3d2cfbb198a6093f15244f119fcb568821606f2b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f6361626c65386d6d2f737475622d74656d706c6174652f7068703f6c6f676f3d504850266c6f676f436f6c6f723d776869746526636f6c6f723d373737424234)](https://packagist.org/packages/cable8mm/stub-template)[![Total Downloads](https://camo.githubusercontent.com/54aea0e2e66e7fbbbe0d6e9d4ac79a31c9226dcccfac4ebbf043420584b8e5ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6361626c65386d6d2f737475622d74656d706c6174652e737667)](https://packagist.org/packages/cable8mm/stub-template)[![Packagist Stars](https://camo.githubusercontent.com/b59c552363a69d925900368aa603fb753cedf7ac9fd57ec65d01824289f1650c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6361626c65386d6d2f737475622d74656d706c617465)](https://github.com/cable8mm/stub-template/stargazers)

The package is not a template engine, but you can use it like one to create stub files when needed.

It needs to be used with [Twig template syntax](https://twig.symfony.com/doc/3.x/templates.html).

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

[](#installation)

You can install the package via composer:

```
composer require cable8mm/stub-template
```

Usage
-----

[](#usage)

```
$stub = Stub::of(__DIR__.'/stubs/sample.stub',
  [
    'title' => 'Home Page',
    'colors' => ['red', 'blue', 'green'],
  ]
)->render()
```

or

```
$stub = Stub::of('stubs/sample.stub',
  [
    'title' => 'Home Page',
    'colors' => ['red', 'blue', 'green'],
  ],
  __DIR__
)->render()
```

stubs/sample.stub :

```
{{ title }} -
