class BladeCompiler extends Compiler implements CompilerInterface (View source)

Traits

Properties

protected Filesystem $files

The Filesystem instance.

from  Compiler
protected string $cachePath

Get the cache path for the compiled views.

from  Compiler
static protected array $componentHashStack

The component name hash stack.

from  CompilesComponents
protected bool $firstCaseInSwitch

Identifier for the first case in switch statement.

from  CompilesConditionals
protected string $lastSection

The name of the last section that was started.

from  CompilesLayouts
protected int $forElseCounter

Counter to keep track of nested forelse statements.

from  CompilesLoops
protected array $extensions

All of the registered extensions.

protected array $customDirectives

All custom "directive" handlers.

protected array $conditions

All custom "condition" handlers.

protected array $precompilers

All of the registered precompilers.

protected string $path

The file currently being compiled.

protected array $compilers

All of the available compiler functions.

protected array $rawTags

Array of opening and closing tags for raw echos.

protected array $contentTags

Array of opening and closing tags for regular echos.

protected array $escapedTags

Array of opening and closing tags for escaped echos.

protected string $echoFormat

The "regular" / legacy echo string format.

$footer

Array of footer lines to be added to template.

protected array $rawBlocks

Array to temporary store the raw blocks found in the template.

protected array $classComponentAliases

The array of class component aliases and their class names.

protected bool $compilesComponentTags

Indicates if component tags should be compiled.

Methods

void
__construct(Filesystem $files, string $cachePath)

Create a new compiler instance.

from  Compiler
string
getCompiledPath(string $path)

Get the path to the compiled version of a view.

from  Compiler
bool
isExpired(string $path)

Determine if the view at the given path is expired.

from  Compiler
string
compileCan(string $expression)

Compile the can statements into valid PHP.

string
compileCannot(string $expression)

Compile the cannot statements into valid PHP.

string
compileCanany(string $expression)

Compile the canany statements into valid PHP.

string
compileElsecan(string $expression)

Compile the else-can statements into valid PHP.

string
compileElsecannot(string $expression)

Compile the else-cannot statements into valid PHP.

string
compileElsecanany(string $expression)

Compile the else-canany statements into valid PHP.

string
compileEndcan()

Compile the end-can statements into valid PHP.

string
compileEndcannot()

Compile the end-cannot statements into valid PHP.

string
compileEndcanany()

Compile the end-canany statements into valid PHP.

string
compileComments(string $value)

Compile Blade comments into an empty string.

string
compileComponent(string $expression)

Compile the component statements into valid PHP.

static string
newComponentHash(string $component)

Get a new component hash for a component name.

static string
compileClassComponentOpening(string $component, string $alias, string $data, string $hash)

Compile a class component opening.

string
compileEndComponent()

Compile the end-component statements into valid PHP.

string
compileEndComponentClass()

Compile the end-component statements into valid PHP.

string
compileSlot(string $expression)

Compile the slot statements into valid PHP.

string
compileEndSlot()

Compile the end-slot statements into valid PHP.

string
compileComponentFirst(string $expression)

Compile the component-first statements into valid PHP.

string
compileEndComponentFirst()

Compile the end-component-first statements into valid PHP.

string
compileProps(string $expression)

Compile the prop statement into valid PHP.

static mixed
sanitizeComponentAttribute(mixed $value)

Sanitize the given component attribute value.

string
compileAuth(string|null $guard = null)

Compile the if-auth statements into valid PHP.

string
compileElseAuth(string|null $guard = null)

Compile the else-auth statements into valid PHP.

string
compileEndAuth()

Compile the end-auth statements into valid PHP.

string
compileEnv(string $environments)

Compile the env statements into valid PHP.

string
compileEndEnv()

Compile the end-env statements into valid PHP.

string
compileProduction()

Compile the production statements into valid PHP.

string
compileEndProduction()

Compile the end-production statements into valid PHP.

string
compileGuest(string|null $guard = null)

Compile the if-guest statements into valid PHP.

string
compileElseGuest(string|null $guard = null)

Compile the else-guest statements into valid PHP.

string
compileEndGuest()

Compile the end-guest statements into valid PHP.

string
compileHasSection(string $expression)

Compile the has-section statements into valid PHP.

string
compileSectionMissing(string $expression)

Compile the section-missing statements into valid PHP.

string
compileIf(string $expression)

Compile the if statements into valid PHP.

string
compileUnless(string $expression)

Compile the unless statements into valid PHP.

string
compileElseif(string $expression)

Compile the else-if statements into valid PHP.

string
compileElse()

Compile the else statements into valid PHP.

string
compileEndif()

Compile the end-if statements into valid PHP.

string
compileEndunless()

Compile the end-unless statements into valid PHP.

string
compileIsset(string $expression)

Compile the if-isset statements into valid PHP.

string
compileEndIsset()

Compile the end-isset statements into valid PHP.

string
compileSwitch(string $expression)

Compile the switch statements into valid PHP.

string
compileCase(string $expression)

Compile the case statements into valid PHP.

string
compileDefault()

Compile the default statements in switch case into valid PHP.

string
compileEndSwitch()

Compile the end switch statements into valid PHP.

string
compileOnce($id = null)

Compile an once block into valid PHP.

string
compileEndOnce()

Compile an end-once block into valid PHP.

string
compileEchos(string $value)

Compile Blade echos into valid PHP.

array
getEchoMethods()

Get the echo methods in the proper order for compilation.

string
compileRawEchos(string $value)

Compile the "raw" echo statements.

string
compileRegularEchos(string $value)

Compile the "regular" echo statements.

string
compileEscapedEchos(string $value)

Compile the escaped echo statements.

string
compileError(string $expression)

Compile the error statements into valid PHP.

string
compileEnderror(string $expression)

Compile the enderror statements into valid PHP.

string
compileCsrf()

Compile the CSRF statements into valid PHP.

string
compileDd(string $arguments)

Compile the "dd" statements into valid PHP.

string
compileDump(string $arguments)

Compile the "dump" statements into valid PHP.

string
compileMethod(string $method)

Compile the method statements into valid PHP.

string
compileEach(string $expression)

Compile the each statements into valid PHP.

string
compileInclude(string $expression)

Compile the include statements into valid PHP.

string
compileIncludeIf(string $expression)

Compile the include-if statements into valid PHP.

string
compileIncludeWhen(string $expression)

Compile the include-when statements into valid PHP.

string
compileIncludeUnless(string $expression)

Compile the include-unless statements into valid PHP.

string
compileIncludeFirst(string $expression)

Compile the include-first statements into valid PHP.

string
compileInject(string $expression)

Compile the inject statements into valid PHP.

string
compileJson(string $expression)

Compile the JSON statement into valid PHP.

string
compileExtends(string $expression)

Compile the extends statements into valid PHP.

string
compileSection(string $expression)

Compile the section statements into valid PHP.

string
compileParent()

Replace the @parent directive to a placeholder.

string
compileYield(string $expression)

Compile the yield statements into valid PHP.

string
compileShow()

Compile the show statements into valid PHP.

string
compileAppend()

Compile the append statements into valid PHP.

string
compileOverwrite()

Compile the overwrite statements into valid PHP.

string
compileStop()

Compile the stop statements into valid PHP.

string
compileEndsection()

Compile the end-section statements into valid PHP.

string
compileForelse(string $expression)

Compile the for-else statements into valid PHP.

string
compileEmpty(string $expression)

Compile the for-else-empty and empty statements into valid PHP.

string
compileEndforelse()

Compile the end-for-else statements into valid PHP.

string
compileEndEmpty()

Compile the end-empty statements into valid PHP.

string
compileFor(string $expression)

Compile the for statements into valid PHP.

string
compileForeach(string $expression)

Compile the for-each statements into valid PHP.

string
compileBreak(string $expression)

Compile the break statements into valid PHP.

string
compileContinue(string $expression)

Compile the continue statements into valid PHP.

string
compileEndfor()

Compile the end-for statements into valid PHP.

string
compileEndforeach()

Compile the end-for-each statements into valid PHP.

string
compileWhile(string $expression)

Compile the while statements into valid PHP.

string
compileEndwhile()

Compile the end-while statements into valid PHP.

string
compilePhp(string $expression)

Compile the raw PHP statements into valid PHP.

string
compileUnset(string $expression)

Compile the unset statements into valid PHP.

string
compileStack(string $expression)

Compile the stack statements into the content.

string
compilePush(string $expression)

Compile the push statements into valid PHP.

string
compileEndpush()

Compile the end-push statements into valid PHP.

string
compilePrepend(string $expression)

Compile the prepend statements into valid PHP.

string
compileEndprepend()

Compile the end-prepend statements into valid PHP.

string
compileLang(string|null $expression)

Compile the lang statements into valid PHP.

string
compileEndlang()

Compile the end-lang statements into valid PHP.

string
compileChoice(string $expression)

Compile the choice statements into valid PHP.

void
compile(string $path = null)

Compile the view at the given path.

string
appendFilePath(string $contents)

Append the file path to the compiled string.

getOpenAndClosingPhpTokens(string $contents)

Get the open and closing PHP tag tokens from the given string.

string
getPath()

Get the path currently being compiled.

void
setPath(string $path)

Set the path currently being compiled.

string
compileString(string $value)

Compile the given Blade template contents.

string
storeUncompiledBlocks(string $value)

Store the blocks that do not receive compilation.

string
storeVerbatimBlocks(string $value)

Store the verbatim blocks and replace them with a temporary placeholder.

string
storePhpBlocks(string $value)

Store the PHP blocks and replace them with a temporary placeholder.

string
storeRawBlock(string $value)

Store a raw block and return a unique raw placeholder.

string
compileComponentTags(string $value)

Compile the component tags.

string
restoreRawContent(string $result)

Replace the raw placeholders with the original code stored in the raw blocks.

string
getRawPlaceholder(int|string $replace)

Get a placeholder to temporary mark the position of raw blocks.

string
addFooters(string $result)

Add the stored footers onto the given content.

string
parseToken(array $token)

Parse the tokens from the template.

string
compileExtensions(string $value)

Execute the user defined extensions.

string
compileStatements(string $value)

Compile Blade statements that start with "@".

string
compileStatement(array $match)

Compile a single Blade @ statement.

string
callCustomDirective(string $name, string|null $value)

Call the given directive with the given value.

string
stripParentheses(string $expression)

Strip the parentheses from the given expression.

void
extend(callable $compiler)

Register a custom Blade compiler.

array
getExtensions()

Get the extensions used by the compiler.

void
if(string $name, callable $callback)

Register an "if" statement directive.

bool
check(string $name, array ...$parameters)

Check the result of a condition.

void
component(string $class, string|null $alias = null, string $prefix = '')

Register a class-based component alias directive.

void
components(array $components, string $prefix = '')

Register an array of class-based components.

array
getClassComponentAliases()

Get the registered class component aliases.

void
aliasComponent(string $path, string|null $alias = null)

Register a component alias directive.

void
include(string $path, string|null $alias = null)

Register an include alias directive.

void
aliasInclude(string $path, string|null $alias = null)

Register an include alias directive.

void
directive(string $name, callable $handler)

Register a handler for custom directives.

array
getCustomDirectives()

Get the list of custom directives.

void
precompiler(callable $precompiler)

Register a new precompiler.

void
setEchoFormat(string $format)

Set the echo format to be used by the compiler.

void
withDoubleEncoding()

Set the "echo" format to double encode entities.

void
withoutDoubleEncoding()

Set the "echo" format to not double encode entities.

void
withoutComponentTags()

Indicate that component tags should not be compiled.

Details

void __construct(Filesystem $files, string $cachePath)

Create a new compiler instance.

Parameters

Filesystem $files
string $cachePath

Return Value

void

Exceptions

InvalidArgumentException

string getCompiledPath(string $path)

Get the path to the compiled version of a view.

Parameters

string $path

Return Value

string

bool isExpired(string $path)

Determine if the view at the given path is expired.

Parameters

string $path

Return Value

bool

protected string compileCan(string $expression)

Compile the can statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileCannot(string $expression)

Compile the cannot statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileCanany(string $expression)

Compile the canany statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileElsecan(string $expression)

Compile the else-can statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileElsecannot(string $expression)

Compile the else-cannot statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileElsecanany(string $expression)

Compile the else-canany statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndcan()

Compile the end-can statements into valid PHP.

Return Value

string

protected string compileEndcannot()

Compile the end-cannot statements into valid PHP.

Return Value

string

protected string compileEndcanany()

Compile the end-canany statements into valid PHP.

Return Value

string

protected string compileComments(string $value)

Compile Blade comments into an empty string.

Parameters

string $value

Return Value

string

protected string compileComponent(string $expression)

Compile the component statements into valid PHP.

Parameters

string $expression

Return Value

string

static string newComponentHash(string $component)

Get a new component hash for a component name.

Parameters

string $component

Return Value

string

static string compileClassComponentOpening(string $component, string $alias, string $data, string $hash)

Compile a class component opening.

Parameters

string $component
string $alias
string $data
string $hash

Return Value

string

protected string compileEndComponent()

Compile the end-component statements into valid PHP.

Return Value

string

string compileEndComponentClass()

Compile the end-component statements into valid PHP.

Return Value

string

protected string compileSlot(string $expression)

Compile the slot statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndSlot()

Compile the end-slot statements into valid PHP.

Return Value

string

protected string compileComponentFirst(string $expression)

Compile the component-first statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndComponentFirst()

Compile the end-component-first statements into valid PHP.

Return Value

string

protected string compileProps(string $expression)

Compile the prop statement into valid PHP.

Parameters

string $expression

Return Value

string

static mixed sanitizeComponentAttribute(mixed $value)

Sanitize the given component attribute value.

Parameters

mixed $value

Return Value

mixed

protected string compileAuth(string|null $guard = null)

Compile the if-auth statements into valid PHP.

Parameters

string|null $guard

Return Value

string

protected string compileElseAuth(string|null $guard = null)

Compile the else-auth statements into valid PHP.

Parameters

string|null $guard

Return Value

string

protected string compileEndAuth()

Compile the end-auth statements into valid PHP.

Return Value

string

protected string compileEnv(string $environments)

Compile the env statements into valid PHP.

Parameters

string $environments

Return Value

string

protected string compileEndEnv()

Compile the end-env statements into valid PHP.

Return Value

string

protected string compileProduction()

Compile the production statements into valid PHP.

Return Value

string

protected string compileEndProduction()

Compile the end-production statements into valid PHP.

Return Value

string

protected string compileGuest(string|null $guard = null)

Compile the if-guest statements into valid PHP.

Parameters

string|null $guard

Return Value

string

protected string compileElseGuest(string|null $guard = null)

Compile the else-guest statements into valid PHP.

Parameters

string|null $guard

Return Value

string

protected string compileEndGuest()

Compile the end-guest statements into valid PHP.

Return Value

string

protected string compileHasSection(string $expression)

Compile the has-section statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileSectionMissing(string $expression)

Compile the section-missing statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileIf(string $expression)

Compile the if statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileUnless(string $expression)

Compile the unless statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileElseif(string $expression)

Compile the else-if statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileElse()

Compile the else statements into valid PHP.

Return Value

string

protected string compileEndif()

Compile the end-if statements into valid PHP.

Return Value

string

protected string compileEndunless()

Compile the end-unless statements into valid PHP.

Return Value

string

protected string compileIsset(string $expression)

Compile the if-isset statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndIsset()

Compile the end-isset statements into valid PHP.

Return Value

string

protected string compileSwitch(string $expression)

Compile the switch statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileCase(string $expression)

Compile the case statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileDefault()

Compile the default statements in switch case into valid PHP.

Return Value

string

protected string compileEndSwitch()

Compile the end switch statements into valid PHP.

Return Value

string

protected string compileOnce($id = null)

Compile an once block into valid PHP.

Parameters

$id

Return Value

string

string compileEndOnce()

Compile an end-once block into valid PHP.

Return Value

string

string compileEchos(string $value)

Compile Blade echos into valid PHP.

Parameters

string $value

Return Value

string

protected array getEchoMethods()

Get the echo methods in the proper order for compilation.

Return Value

array

protected string compileRawEchos(string $value)

Compile the "raw" echo statements.

Parameters

string $value

Return Value

string

protected string compileRegularEchos(string $value)

Compile the "regular" echo statements.

Parameters

string $value

Return Value

string

protected string compileEscapedEchos(string $value)

Compile the escaped echo statements.

Parameters

string $value

Return Value

string

protected string compileError(string $expression)

Compile the error statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEnderror(string $expression)

Compile the enderror statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileCsrf()

Compile the CSRF statements into valid PHP.

Return Value

string

protected string compileDd(string $arguments)

Compile the "dd" statements into valid PHP.

Parameters

string $arguments

Return Value

string

protected string compileDump(string $arguments)

Compile the "dump" statements into valid PHP.

Parameters

string $arguments

Return Value

string

protected string compileMethod(string $method)

Compile the method statements into valid PHP.

Parameters

string $method

Return Value

string

protected string compileEach(string $expression)

Compile the each statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileInclude(string $expression)

Compile the include statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileIncludeIf(string $expression)

Compile the include-if statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileIncludeWhen(string $expression)

Compile the include-when statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileIncludeUnless(string $expression)

Compile the include-unless statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileIncludeFirst(string $expression)

Compile the include-first statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileInject(string $expression)

Compile the inject statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileJson(string $expression)

Compile the JSON statement into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileExtends(string $expression)

Compile the extends statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileSection(string $expression)

Compile the section statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileParent()

Replace the @parent directive to a placeholder.

Return Value

string

protected string compileYield(string $expression)

Compile the yield statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileShow()

Compile the show statements into valid PHP.

Return Value

string

protected string compileAppend()

Compile the append statements into valid PHP.

Return Value

string

protected string compileOverwrite()

Compile the overwrite statements into valid PHP.

Return Value

string

protected string compileStop()

Compile the stop statements into valid PHP.

Return Value

string

protected string compileEndsection()

Compile the end-section statements into valid PHP.

Return Value

string

protected string compileForelse(string $expression)

Compile the for-else statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEmpty(string $expression)

Compile the for-else-empty and empty statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndforelse()

Compile the end-for-else statements into valid PHP.

Return Value

string

protected string compileEndEmpty()

Compile the end-empty statements into valid PHP.

Return Value

string

protected string compileFor(string $expression)

Compile the for statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileForeach(string $expression)

Compile the for-each statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileBreak(string $expression)

Compile the break statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileContinue(string $expression)

Compile the continue statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndfor()

Compile the end-for statements into valid PHP.

Return Value

string

protected string compileEndforeach()

Compile the end-for-each statements into valid PHP.

Return Value

string

protected string compileWhile(string $expression)

Compile the while statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndwhile()

Compile the end-while statements into valid PHP.

Return Value

string

protected string compilePhp(string $expression)

Compile the raw PHP statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileUnset(string $expression)

Compile the unset statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileStack(string $expression)

Compile the stack statements into the content.

Parameters

string $expression

Return Value

string

protected string compilePush(string $expression)

Compile the push statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndpush()

Compile the end-push statements into valid PHP.

Return Value

string

protected string compilePrepend(string $expression)

Compile the prepend statements into valid PHP.

Parameters

string $expression

Return Value

string

protected string compileEndprepend()

Compile the end-prepend statements into valid PHP.

Return Value

string

protected string compileLang(string|null $expression)

Compile the lang statements into valid PHP.

Parameters

string|null $expression

Return Value

string

protected string compileEndlang()

Compile the end-lang statements into valid PHP.

Return Value

string

protected string compileChoice(string $expression)

Compile the choice statements into valid PHP.

Parameters

string $expression

Return Value

string

void compile(string $path = null)

Compile the view at the given path.

Parameters

string $path

Return Value

void

protected string appendFilePath(string $contents)

Append the file path to the compiled string.

Parameters

string $contents

Return Value

string

protected Collection getOpenAndClosingPhpTokens(string $contents)

Get the open and closing PHP tag tokens from the given string.

Parameters

string $contents

Return Value

Collection

string getPath()

Get the path currently being compiled.

Return Value

string

void setPath(string $path)

Set the path currently being compiled.

Parameters

string $path

Return Value

void

string compileString(string $value)

Compile the given Blade template contents.

Parameters

string $value

Return Value

string

protected string storeUncompiledBlocks(string $value)

Store the blocks that do not receive compilation.

Parameters

string $value

Return Value

string

protected string storeVerbatimBlocks(string $value)

Store the verbatim blocks and replace them with a temporary placeholder.

Parameters

string $value

Return Value

string

protected string storePhpBlocks(string $value)

Store the PHP blocks and replace them with a temporary placeholder.

Parameters

string $value

Return Value

string

protected string storeRawBlock(string $value)

Store a raw block and return a unique raw placeholder.

Parameters

string $value

Return Value

string

protected string compileComponentTags(string $value)

Compile the component tags.

Parameters

string $value

Return Value

string

protected string restoreRawContent(string $result)

Replace the raw placeholders with the original code stored in the raw blocks.

Parameters

string $result

Return Value

string

protected string getRawPlaceholder(int|string $replace)

Get a placeholder to temporary mark the position of raw blocks.

Parameters

int|string $replace

Return Value

string

protected string addFooters(string $result)

Add the stored footers onto the given content.

Parameters

string $result

Return Value

string

protected string parseToken(array $token)

Parse the tokens from the template.

Parameters

array $token

Return Value

string

protected string compileExtensions(string $value)

Execute the user defined extensions.

Parameters

string $value

Return Value

string

protected string compileStatements(string $value)

Compile Blade statements that start with "@".

Parameters

string $value

Return Value

string

protected string compileStatement(array $match)

Compile a single Blade @ statement.

Parameters

array $match

Return Value

string

protected string callCustomDirective(string $name, string|null $value)

Call the given directive with the given value.

Parameters

string $name
string|null $value

Return Value

string

string stripParentheses(string $expression)

Strip the parentheses from the given expression.

Parameters

string $expression

Return Value

string

void extend(callable $compiler)

Register a custom Blade compiler.

Parameters

callable $compiler

Return Value

void

array getExtensions()

Get the extensions used by the compiler.

Return Value

array

void if(string $name, callable $callback)

Register an "if" statement directive.

Parameters

string $name
callable $callback

Return Value

void

bool check(string $name, array ...$parameters)

Check the result of a condition.

Parameters

string $name
array ...$parameters

Return Value

bool

void component(string $class, string|null $alias = null, string $prefix = '')

Register a class-based component alias directive.

Parameters

string $class
string|null $alias
string $prefix

Return Value

void

void components(array $components, string $prefix = '')

Register an array of class-based components.

Parameters

array $components
string $prefix

Return Value

void

array getClassComponentAliases()

Get the registered class component aliases.

Return Value

array

void aliasComponent(string $path, string|null $alias = null)

Register a component alias directive.

Parameters

string $path
string|null $alias

Return Value

void

void include(string $path, string|null $alias = null)

Register an include alias directive.

Parameters

string $path
string|null $alias

Return Value

void

void aliasInclude(string $path, string|null $alias = null)

Register an include alias directive.

Parameters

string $path
string|null $alias

Return Value

void

void directive(string $name, callable $handler)

Register a handler for custom directives.

Parameters

string $name
callable $handler

Return Value

void

Exceptions

InvalidArgumentException

array getCustomDirectives()

Get the list of custom directives.

Return Value

array

void precompiler(callable $precompiler)

Register a new precompiler.

Parameters

callable $precompiler

Return Value

void

void setEchoFormat(string $format)

Set the echo format to be used by the compiler.

Parameters

string $format

Return Value

void

void withDoubleEncoding()

Set the "echo" format to double encode entities.

Return Value

void

void withoutDoubleEncoding()

Set the "echo" format to not double encode entities.

Return Value

void

void withoutComponentTags()

Indicate that component tags should not be compiled.

Return Value

void