Skip to content

1.2.0

Choose a tag to compare

@JohnathonKoster JohnathonKoster released this 02 Mar 00:23
· 64 commits to master since this release
2534d0f

This release introduces a new onlyParseComponents method to the DocumentParser class, allowing users to only parse components within an input template:

<?php

use Stillat\BladeParser\Parser\DocumentParser;
use Stillat\BladeParser\Document\Document;

$parser = new DocumentParser;

$template = <<<'BLADE'
<x-alert>
    {{ $title }} @if ($this) @endif
</x-alert>
BLADE;

// Only the components are parsed.
$parser->onlyParseComponents()->parse($template);

// To construct a Document instance and resolve tag pairs, we may use `syncFromParser`
$document = new Document;
$document->syncFromParser($parser)->resolveStructures();