class BladeCompiler extends Compiler implements CompilerInterface (View source)
protected Filesystem | $files | The Filesystem instance. | from Compiler |
protected string | $cachePath | Get the cache path for the compiled views. | from Compiler |
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 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. | |
protected array | $footer | Array of footer lines to be added to template. | |
protected array | $rawBlocks | Array to temporary store the raw blocks found in the template. |
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. | from CompilesAuthorizations |
string | compileCannot(string $expression) Compile the cannot statements into valid PHP. | from CompilesAuthorizations |
string | compileCanany(string $expression) Compile the canany statements into valid PHP. | from CompilesAuthorizations |
string | compileElsecan(string $expression) Compile the else-can statements into valid PHP. | from CompilesAuthorizations |
string | compileElsecannot(string $expression) Compile the else-cannot statements into valid PHP. | from CompilesAuthorizations |
string | compileElsecanany(string $expression) Compile the else-canany statements into valid PHP. | from CompilesAuthorizations |
string | compileEndcan() Compile the end-can statements into valid PHP. | from CompilesAuthorizations |
string | compileEndcannot() Compile the end-cannot statements into valid PHP. | from CompilesAuthorizations |
string | compileEndcanany() Compile the end-canany statements into valid PHP. | from CompilesAuthorizations |
string | compileComments(string $value) Compile Blade comments into an empty string. | from CompilesComments |
string | compileComponent(string $expression) Compile the component statements into valid PHP. | from CompilesComponents |
string | compileEndComponent() Compile the end-component statements into valid PHP. | from CompilesComponents |
string | compileSlot(string $expression) Compile the slot statements into valid PHP. | from CompilesComponents |
string | compileEndSlot() Compile the end-slot statements into valid PHP. | from CompilesComponents |
string | compileComponentFirst(string $expression) Compile the component-first statements into valid PHP. | from CompilesComponents |
string | compileEndComponentFirst() Compile the end-component-first statements into valid PHP. | from CompilesComponents |
string | compileAuth(string|null $guard = null) Compile the if-auth statements into valid PHP. | from CompilesConditionals |
string | compileElseAuth(string|null $guard = null) Compile the else-auth statements into valid PHP. | from CompilesConditionals |
string | compileEndAuth() Compile the end-auth statements into valid PHP. | from CompilesConditionals |
string | compileGuest(string|null $guard = null) Compile the if-guest statements into valid PHP. | from CompilesConditionals |
string | compileElseGuest(string|null $guard = null) Compile the else-guest statements into valid PHP. | from CompilesConditionals |
string | compileEndGuest() Compile the end-guest statements into valid PHP. | from CompilesConditionals |
string | compileHasSection(string $expression) Compile the has-section statements into valid PHP. | from CompilesConditionals |
string | compileIf(string $expression) Compile the if statements into valid PHP. | from CompilesConditionals |
string | compileUnless(string $expression) Compile the unless statements into valid PHP. | from CompilesConditionals |
string | compileElseif(string $expression) Compile the else-if statements into valid PHP. | from CompilesConditionals |
string | compileElse() Compile the else statements into valid PHP. | from CompilesConditionals |
string | compileEndif() Compile the end-if statements into valid PHP. | from CompilesConditionals |
string | compileEndunless() Compile the end-unless statements into valid PHP. | from CompilesConditionals |
string | compileIsset(string $expression) Compile the if-isset statements into valid PHP. | from CompilesConditionals |
string | compileEndIsset() Compile the end-isset statements into valid PHP. | from CompilesConditionals |
string | compileSwitch(string $expression) Compile the switch statements into valid PHP. | from CompilesConditionals |
string | compileCase(string $expression) Compile the case statements into valid PHP. | from CompilesConditionals |
string | compileDefault() Compile the default statements in switch case into valid PHP. | from CompilesConditionals |
string | compileEndSwitch() Compile the end switch statements into valid PHP. | from CompilesConditionals |
string | compileEchos(string $value) Compile Blade echos into valid PHP. | from CompilesEchos |
array | getEchoMethods() Get the echo methods in the proper order for compilation. | from CompilesEchos |
string | compileRawEchos(string $value) Compile the "raw" echo statements. | from CompilesEchos |
string | compileRegularEchos(string $value) Compile the "regular" echo statements. | from CompilesEchos |
string | compileEscapedEchos(string $value) Compile the escaped echo statements. | from CompilesEchos |
string | compileError(string $expression) Compile the error statements into valid PHP. | from CompilesErrors |
string | compileEnderror(string $expression) Compile the enderror statements into valid PHP. | from CompilesErrors |
string | compileCsrf() Compile the CSRF statements into valid PHP. | from CompilesHelpers |
string | compileDd(string $arguments) Compile the "dd" statements into valid PHP. | from CompilesHelpers |
string | compileDump(string $arguments) Compile the "dump" statements into valid PHP. | from CompilesHelpers |
string | compileMethod(string $method) Compile the method statements into valid PHP. | from CompilesHelpers |
string | compileEach(string $expression) Compile the each statements into valid PHP. | from CompilesIncludes |
string | compileInclude(string $expression) Compile the include statements into valid PHP. | from CompilesIncludes |
string | compileIncludeIf(string $expression) Compile the include-if statements into valid PHP. | from CompilesIncludes |
string | compileIncludeWhen(string $expression) Compile the include-when statements into valid PHP. | from CompilesIncludes |
string | compileIncludeFirst(string $expression) Compile the include-first statements into valid PHP. | from CompilesIncludes |
string | compileInject(string $expression) Compile the inject statements into valid PHP. | from CompilesInjections |
string | compileJson(string $expression) Compile the JSON statement into valid PHP. | from CompilesJson |
string | compileExtends(string $expression) Compile the extends statements into valid PHP. | from CompilesLayouts |
string | compileSection(string $expression) Compile the section statements into valid PHP. | from CompilesLayouts |
string | compileParent() Replace the @parent directive to a placeholder. | from CompilesLayouts |
string | compileYield(string $expression) Compile the yield statements into valid PHP. | from CompilesLayouts |
string | compileShow() Compile the show statements into valid PHP. | from CompilesLayouts |
string | compileAppend() Compile the append statements into valid PHP. | from CompilesLayouts |
string | compileOverwrite() Compile the overwrite statements into valid PHP. | from CompilesLayouts |
string | compileStop() Compile the stop statements into valid PHP. | from CompilesLayouts |
string | compileEndsection() Compile the end-section statements into valid PHP. | from CompilesLayouts |
string | compileForelse(string $expression) Compile the for-else statements into valid PHP. | from CompilesLoops |
string | compileEmpty(string $expression) Compile the for-else-empty and empty statements into valid PHP. | from CompilesLoops |
string | compileEndforelse() Compile the end-for-else statements into valid PHP. | from CompilesLoops |
string | compileEndEmpty() Compile the end-empty statements into valid PHP. | from CompilesLoops |
string | compileFor(string $expression) Compile the for statements into valid PHP. | from CompilesLoops |
string | compileForeach(string $expression) Compile the for-each statements into valid PHP. | from CompilesLoops |
string | compileBreak(string $expression) Compile the break statements into valid PHP. | from CompilesLoops |
string | compileContinue(string $expression) Compile the continue statements into valid PHP. | from CompilesLoops |
string | compileEndfor() Compile the end-for statements into valid PHP. | from CompilesLoops |
string | compileEndforeach() Compile the end-for-each statements into valid PHP. | from CompilesLoops |
string | compileWhile(string $expression) Compile the while statements into valid PHP. | from CompilesLoops |
string | compileEndwhile() Compile the end-while statements into valid PHP. | from CompilesLoops |
string | compilePhp(string $expression) Compile the raw PHP statements into valid PHP. | from CompilesRawPhp |
string | compileUnset(string $expression) Compile the unset statements into valid PHP. | from CompilesRawPhp |
string | compileStack(string $expression) Compile the stack statements into the content. | from CompilesStacks |
string | compilePush(string $expression) Compile the push statements into valid PHP. | from CompilesStacks |
string | compileEndpush() Compile the end-push statements into valid PHP. | from CompilesStacks |
string | compilePrepend(string $expression) Compile the prepend statements into valid PHP. | from CompilesStacks |
string | compileEndprepend() Compile the end-prepend statements into valid PHP. | from CompilesStacks |
string | compileLang(string $expression) Compile the lang statements into valid PHP. | from CompilesTranslations |
string | compileEndlang() Compile the end-lang statements into valid PHP. | from CompilesTranslations |
string | compileChoice(string $expression) Compile the choice statements into valid PHP. | from CompilesTranslations |
void | compile(string $path = null) Compile the view at the given path. | |
Collection | 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 | 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 | 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 $path, string|null $alias = null) Register a component alias directive. | |
void | include(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 | 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. |
Create a new compiler instance.
Get the path to the compiled version of a view.
Determine if the view at the given path is expired.
Compile the can statements into valid PHP.
Compile the cannot statements into valid PHP.
Compile the canany statements into valid PHP.
Compile the else-can statements into valid PHP.
Compile the else-cannot statements into valid PHP.
Compile the else-canany statements into valid PHP.
Compile the end-can statements into valid PHP.
Compile the end-cannot statements into valid PHP.
Compile the end-canany statements into valid PHP.
Compile Blade comments into an empty string.
Compile the component statements into valid PHP.
Compile the end-component statements into valid PHP.
Compile the slot statements into valid PHP.
Compile the end-slot statements into valid PHP.
Compile the component-first statements into valid PHP.
Compile the end-component-first statements into valid PHP.
Compile the if-auth statements into valid PHP.
Compile the else-auth statements into valid PHP.
Compile the end-auth statements into valid PHP.
Compile the if-guest statements into valid PHP.
Compile the else-guest statements into valid PHP.
Compile the end-guest statements into valid PHP.
Compile the has-section statements into valid PHP.
Compile the if statements into valid PHP.
Compile the unless statements into valid PHP.
Compile the else-if statements into valid PHP.
Compile the else statements into valid PHP.
Compile the end-if statements into valid PHP.
Compile the end-unless statements into valid PHP.
Compile the if-isset statements into valid PHP.
Compile the end-isset statements into valid PHP.
Compile the switch statements into valid PHP.
Compile the case statements into valid PHP.
Compile the default statements in switch case into valid PHP.
Compile the end switch statements into valid PHP.
Compile Blade echos into valid PHP.
Get the echo methods in the proper order for compilation.
Compile the "raw" echo statements.
Compile the "regular" echo statements.
Compile the escaped echo statements.
Compile the error statements into valid PHP.
Compile the enderror statements into valid PHP.
Compile the CSRF statements into valid PHP.
Compile the "dd" statements into valid PHP.
Compile the "dump" statements into valid PHP.
Compile the method statements into valid PHP.
Compile the each statements into valid PHP.
Compile the include statements into valid PHP.
Compile the include-if statements into valid PHP.
Compile the include-when statements into valid PHP.
Compile the include-first statements into valid PHP.
Compile the inject statements into valid PHP.
Compile the JSON statement into valid PHP.
Compile the extends statements into valid PHP.
Compile the section statements into valid PHP.
Replace the @parent directive to a placeholder.
Compile the yield statements into valid PHP.
Compile the show statements into valid PHP.
Compile the append statements into valid PHP.
Compile the overwrite statements into valid PHP.
Compile the stop statements into valid PHP.
Compile the end-section statements into valid PHP.
Compile the for-else statements into valid PHP.
Compile the for-else-empty and empty statements into valid PHP.
Compile the end-for-else statements into valid PHP.
Compile the end-empty statements into valid PHP.
Compile the for statements into valid PHP.
Compile the for-each statements into valid PHP.
Compile the break statements into valid PHP.
Compile the continue statements into valid PHP.
Compile the end-for statements into valid PHP.
Compile the end-for-each statements into valid PHP.
Compile the while statements into valid PHP.
Compile the end-while statements into valid PHP.
Compile the raw PHP statements into valid PHP.
Compile the unset statements into valid PHP.
Compile the stack statements into the content.
Compile the push statements into valid PHP.
Compile the end-push statements into valid PHP.
Compile the prepend statements into valid PHP.
Compile the end-prepend statements into valid PHP.
Compile the lang statements into valid PHP.
Compile the end-lang statements into valid PHP.
Compile the choice statements into valid PHP.
Compile the view at the given path.
Get the open and closing PHP tag tokens from the given string.
Get the path currently being compiled.
Set the path currently being compiled.
Compile the given Blade template contents.
Store the verbatim blocks and replace them with a temporary placeholder.
Store the PHP blocks and replace them with a temporary placeholder.
Store a raw block and return a unique raw placeholder.
Replace the raw placeholders with the original code stored in the raw blocks.
Get a placeholder to temporary mark the position of raw blocks.
Add the stored footers onto the given content.
Parse the tokens from the template.
Execute the user defined extensions.
Compile Blade statements that start with "@".
Compile a single Blade @ statement.
Call the given directive with the given value.
Strip the parentheses from the given expression.
Register a custom Blade compiler.
Get the extensions used by the compiler.
Register an "if" statement directive.
Check the result of a condition.
Register a component alias directive.
Register an include alias directive.
Register a handler for custom directives.
Get the list of custom directives.
Set the echo format to be used by the compiler.
Set the "echo" format to double encode entities.
Set the "echo" format to not double encode entities.
© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.8/Illuminate/View/Compilers/BladeCompiler.html