Neuron-PHP

MemoryTemplateEngine
in package
implements ITemplateEngine

In-memory template engine for testing

Table of Contents

Interfaces

ITemplateEngine
Template engine for loading and rendering stub files

Properties

$templates  : array<string|int, mixed>

Methods

addTemplate()  : self
Add a template to memory
exists()  : bool
Check if a template exists
load()  : string|null
Load raw template content
render()  : string
Render template with data replacements

Properties

Methods

addTemplate()

Add a template to memory

public addTemplate(string $name, string $content) : self
Parameters
$name : string

Template name

$content : string

Template content

Return values
self

exists()

Check if a template exists

public exists(string $template) : bool
Parameters
$template : string

Template name (e.g., 'controller.resource.stub')

Tags
inheritDoc
Return values
bool

load()

Load raw template content

public load(string $template) : string|null
Parameters
$template : string

Template name

Tags
inheritDoc
Return values
string|null

Template content or null if not found

render()

Render template with data replacements

public render(string $template, array<string|int, mixed> $data) : string
Parameters
$template : string

Template name

$data : array<string|int, mixed>

Key-value pairs for {{placeholder}} replacement

Tags
inheritDoc
Return values
string

Rendered content


        
On this page

Search results