class Illuminate / View / Compilers / BladeCompiler

BladeCompiler

Extends

Implements

Uses

Properties

protected

$extensions array

All of the registered extensions.

Default: []
protected

$customDirectives array

All custom "directive" handlers.

Default: []
protected

$conditions array

All custom "condition" handlers.

Default: []
protected

$prepareStringsForCompilationUsing array

The registered string preparation callbacks.

Default: []
protected

$precompilers array

All of the registered precompilers.

Default: []
protected

$path string

The file currently being compiled.

Default: null
protected

$compilers string[]

All of the available compiler functions.

Default: array
protected

$rawTags string[]

Array of opening and closing tags for raw echos.

Default: array
protected

$contentTags string[]

Array of opening and closing tags for regular echos.

Default: array
protected

$escapedTags string[]

Array of opening and closing tags for escaped echos.

Default: array
protected

$echoFormat string

The "regular" / legacy echo string format.

Default: 'e(%s)'
protected

Array of footer lines to be added to the template.

Default: []
protected

$rawBlocks array

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

Default: []
protected

$anonymousComponentPaths array

The array of anonymous component paths to search for components in.

Default: []
protected

$anonymousComponentNamespaces array

The array of anonymous component namespaces to autoload from.

Default: []
protected

$classComponentAliases array

The array of class component aliases and their class names.

Default: []
protected

$classComponentNamespaces array

The array of class component namespaces to autoload from.

Default: []
protected

$compilesComponentTags bool

Indicates if component tags should be compiled.

Default: true

Methods

public

compile ( $path ) : void

Compile the view at the given path.

Parameters

  • $path string|null
protected

appendFilePath ( $contents ) : string

Append the file path to the compiled string.

Parameters

  • $contents string
protected

getOpenAndClosingPhpTokens ( $contents ) : Illuminate\...\Collection

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

Parameters

  • $contents string
public

getPath ( ) : string

Get the path currently being compiled.

public

setPath ( $path ) : void

Set the path currently being compiled.

Parameters

  • $path string
public

compileString ( $value ) : string

Compile the given Blade template contents.

Parameters

  • $value string
public static

render ( $string , $data , $deleteCachedView ) : string

Evaluate and render a Blade string to HTML.

Parameters

  • $string string
  • $data array
  • $deleteCachedView bool
public static

renderComponent ( Component $component ) : string

Render a component instance to HTML.

Parameters

protected

storeUncompiledBlocks ( $value ) : string

Store the blocks that do not receive compilation.

Parameters

  • $value string
protected

storeVerbatimBlocks ( $value ) : string

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

Parameters

  • $value string
protected

storePhpBlocks ( $value ) : string

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

Parameters

  • $value string
protected

storeRawBlock ( $value ) : string

Store a raw block and return a unique raw placeholder.

Parameters

  • $value string
protected

compileComponentTags ( $value ) : string

Compile the component tags.

Parameters

  • $value string
protected

restoreRawContent ( $result ) : string

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

Parameters

  • $result string
protected

getRawPlaceholder ( $replace ) : string

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

Parameters

  • $replace int|string
protected

addFooters ( $result ) : string

Add the stored footers onto the given content.

Parameters

  • $result string
protected

parseToken ( $token ) : string

Parse the tokens from the template.

Parameters

  • $token array
protected

compileExtensions ( $value ) : string

Execute the user defined extensions.

Parameters

  • $value string
protected

compileStatements ( $template ) : string

Compile Blade statements that start with "@".

Parameters

  • $template string
protected

replaceFirstStatement ( $search , $replace , $subject , $offset ) : array

Replace the first match for a statement compilation operation.

Parameters

  • $search string
  • $replace string
  • $subject string
  • $offset int
protected

hasEvenNumberOfParentheses ( string $expression ) : bool

Determine if the given expression has the same number of opening and closing parentheses.

Parameters

  • $expression string
protected

compileStatement ( $match ) : string

Compile a single Blade @ statement.

Parameters

  • $match array
protected

callCustomDirective ( $name , $value ) : string

Call the given directive with the given value.

Parameters

  • $name string
  • $value string|null
public

stripParentheses ( $expression ) : string

Strip the parentheses from the given expression.

Parameters

  • $expression string
public

extend ( callable $compiler ) : void

Register a custom Blade compiler.

Parameters

  • $compiler callable
public

getExtensions ( ) : array

Get the extensions used by the compiler.

public

if ( $name , callable $callback ) : void

Register an "if" statement directive.

Parameters

  • $name string
  • $callback callable
public

check ( $name , $parameters ) : bool

Check the result of a condition.

Parameters

  • $name string
  • $parameters mixed
public

component ( $class , $alias , $prefix ) : void

Register a class-based component alias directive.

Parameters

  • $class string
  • $alias string|null
  • $prefix string
public

components ( array $components , $prefix ) : void

Register an array of class-based components.

Parameters

  • $components array
  • $prefix string
public

getClassComponentAliases ( ) : array

Get the registered class component aliases.

public

anonymousComponentPath ( string $path , string $prefix ) : void

Register a new anonymous component path.

Parameters

  • $path string
  • $prefix string|null
public

anonymousComponentNamespace ( string $directory , string $prefix ) : void

Register an anonymous component namespace.

Parameters

  • $directory string
  • $prefix string|null
public

componentNamespace ( $namespace , $prefix ) : void

Register a class-based component namespace.

Parameters

  • $namespace string
  • $prefix string
public

getAnonymousComponentPaths ( ) : array

Get the registered anonymous component paths.

public

getAnonymousComponentNamespaces ( ) : array

Get the registered anonymous component namespaces.

public

getClassComponentNamespaces ( ) : array

Get the registered class component namespaces.

public

aliasComponent ( $path , $alias ) : void

Register a component alias directive.

Parameters

  • $path string
  • $alias string|null
public

include ( $path , $alias ) : void

Register an include alias directive.

Parameters

  • $path string
  • $alias string|null
public

aliasInclude ( $path , $alias ) : void

Register an include alias directive.

Parameters

  • $path string
  • $alias string|null
public

directive ( $name , callable $handler ) : void

Register a handler for custom directives.

Parameters

  • $name string
  • $handler callable
public

getCustomDirectives ( ) : array

Get the list of custom directives.

public

prepareStringsForCompilationUsing ( callable $callback ) : $this

Indicate that the following callable should be used to prepare strings for compilation.

Parameters

  • $callback callable
public

precompiler ( callable $precompiler ) : void

Register a new precompiler.

Parameters

  • $precompiler callable
public

setEchoFormat ( $format ) : void

Set the echo format to be used by the compiler.

Parameters

  • $format string
public

withDoubleEncoding ( ) : void

Set the "echo" format to double encode entities.

public

withoutDoubleEncoding ( ) : void

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

public

withoutComponentTags ( ) : void

Indicate that component tags should not be compiled.