BladeRenderer
in package
Singleton Blade template renderer for the AtoM AHG Framework.
Configures and exposes the Laravel Blade compiler, bridging Symfony helpers via custom directives and shared variables.
Table of Contents
Methods
- addNamespace() : void
- Add a namespaced view path (e.g., 'vendor' => path).
- addPath() : void
- Add a view path for the file finder.
- getCompiler() : BladeCompiler
- Access the BladeCompiler for custom directive registration.
- getFactory() : Factory
- Access the ViewFactory.
- getInstance() : self
- Get the singleton instance.
- render() : string
- Render a Blade template to string.
- reset() : void
- Reset the singleton (for testing purposes).
Methods
addNamespace()
Add a namespaced view path (e.g., 'vendor' => path).
public
addNamespace(string $namespace, string $path) : void
Usage in templates: @include('vendor::partials.header')
Parameters
- $namespace : string
- $path : string
addPath()
Add a view path for the file finder.
public
addPath(string $path[, string|null $namespace = null ]) : void
Paths added later take priority (checked first).
Parameters
- $path : string
-
Absolute directory path
- $namespace : string|null = null
-
Optional namespace (e.g., 'vendor')
getCompiler()
Access the BladeCompiler for custom directive registration.
public
getCompiler() : BladeCompiler
Return values
BladeCompilergetFactory()
Access the ViewFactory.
public
getFactory() : Factory
Return values
FactorygetInstance()
Get the singleton instance.
public
static getInstance() : self
Return values
selfrender()
Render a Blade template to string.
public
render(string $view[, array<string|int, mixed> $data = [] ]) : string
Parameters
- $view : string
-
Dot-notation view name (e.g., 'layouts.admin')
- $data : array<string|int, mixed> = []
-
Variables to pass to the template
Return values
stringreset()
Reset the singleton (for testing purposes).
public
static reset() : void