NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
Packagist
Packagist, #1344 most downloaded on Packagist
Latest stable
v2.1.0
Last release 8 months ago
26 Feb 2026
Ships unpredictably
gaps range from 1 weeks to 12 months
Nearly every release is documented
notes for 24 of 26 stable releases
Nothing withdrawn
no release was ever pulled
4 years old
26 releases · first in 2022
Drag across the ruler to compare, or tap a release to open it.
Supports Laravel 13 by @duncanmcclean in #42
Full Changelog: https://github.com/Stillat/blade-parser/compare/v2.0.0...v2.1.0
Minimum PHP version is now 8.2.0
8.2.0Your coding agent can read these notes before it upgrades. Set up the MCP server →
Improves parsing of component attribute echo values
Adds license to composer.json - thanks @vintagesucks !
composer.json - thanks @vintagesucks !Restores support for PHP 8.1
This release adds a few new helper methods:
This release adds a few new helper methods:
toDocument() on DocumentParser simplifies the process of converting an existing DocumentParser to a Document instance
toDocument will resolve structures on the document by default. To prevent this, simply supply false when calling (i.e., toDocument(false))parseTemplate on DocumentParser parses the input like the existing parse method, but will return the DocumentParser instance instead of a node arrayAttributeCompilerThe AttributeCompiler is a new compiler service that can be used to compile attributes/parameters on a parsed ComponentNode. The AttributeCompiler implementation will use the core Laravel compiler for content that contains interpolated values.
Usage:
<?php
use Stillat\BladeParser\Parser\DocumentParser;
use Stillat\BladeParser\Compiler\CompilerServices\AttributeCompiler;
$template = <<<'TEMPLATE'
<prefix:component
parameter="content"
:binding="$theVariable"
/>
TEMPLATE;
$params = (new DocumentParser)
->onlyParseComponents()
->registerCustomComponentTags(['prefix'])
->parseTemplate($template)
->toDocument()
->getComponents()
->first()
->parameters;
$compiler = new AttributeCompiler;
$result = $compiler->compile($params);After compilation, $result would contain the following:
['parameter'=>'content','binding'=>$theVariable]
This release adds a few new helper methods:
toDocument() on DocumentParser simplifies the process of converting an existing DocumentParser to a Document instance
toDocument will resolve structures on the document by default. To prevent this, simply supply false when calling (i.e., toDocument(false))parseTemplate on DocumentParser parses the input like the existing parse method, but will return the DocumentParser instance instead of a node arrayAttributeCompilerThe AttributeCompiler is a new compiler service that can be used to compile attributes/parameters on a parsed ComponentNode. The AttributeCompiler implementation will use the core Laravel compiler for content that contains interpolated values.
Usage:
<?php
use Stillat\BladeParser\Parser\DocumentParser;
use Stillat\BladeParser\Compiler\CompilerServices\AttributeCompiler;
$template = <<<'TEMPLATE'
<prefix:component
parameter="content"
:binding="$theVariable"
/>
TEMPLATE;
$params = (new DocumentParser)
->onlyParseComponents()
->registerCustomComponentTags(['prefix'])
->parseTemplate($template)
->toDocument()
->getComponents()
->first()
->parameters;
$compiler = new AttributeCompiler;
$result = $compiler->compile($params);
After compilation, $result would contain the following:
['parameter'=>'content','binding'=>$theVariable]
Bumps the minimum PHP version to 8.2
Adds new helper methods to determine the type of an EchoNode
EchoNode
EchoNode::isRaw(), EchoNode::isTriple(), and EchoNode::isRegular()Improves validation of @parent directive. Thanks @ernix 🥳
@parent directive. Thanks @ernix 🥳Corrects an issue with directory cleanup #29 (thanks @ernix !)
Updates dependencies to allow Laravel 11
This release improves the out-of-box experience with the document validator:
This release improves the out-of-box experience with the document validator:
In addition, this PR makes the following changes:
ignore_directives validation configuration option will now be used to disable parsing and compilation across all validators, for consistency (#25)Updates the component tag compiler to have parity with latest Laravel changes
@use directiveUpdate PHP version constraint to match language features used
Update PHP version constraint to match language features used
This release improves the built-in compiler's support for complicated PHP expressions within the @json directive.
This release improves the built-in compiler's support for complicated PHP expressions within the @json directive.
Additionally, this release adds a new abstract node transformer. This transformer provides a simple way to iterate all nodes in a document and change the output, while skipping over nodes within the document.
For example, if we had the following node transformer implementation:
<?php
use Stillat\BladeParser\Compiler\Transformers\NodeTransformer;
use Stillat\BladeParser\Nodes\DirectiveNode;
class CustomTransformer extends NodeTransformer
{
public function transformNode($node): ?string
{
if (! $node instanceof DirectiveNode || $node->content != 'custom') {
return null;
}
$this->skipToNode($node->isClosedBy);
return '@include("something-here")';
}
}
we could transform a document like so:
<?php
use Stillat\BladeParser\Document\Document;
use Stillat\BladeParser\Document\DocumentOptions;
$doc = Document::fromText($template, documentOptions: new DocumentOptions(
withCoreDirectives: false,
customDirectives: ['custom', 'endcustom']
))->resolveStructures();
$result = (new CustomTransformer())->transformDocument($doc);
to produce the final result:
The beginning.
@include("something-here")
The end.
This release adds support for compiling name attributes on named slots:
This release adds support for compiling name attributes on named slots:
<x-input-with-slot>
<x-slot class="text-input-lg" name="the_slot_name" data-test="data">Test</x-slot>
</x-input-with-slot>
Additionally, we can now easily fetch either a ParameterNode or the slot's string name via. some new utility methods:
<?php
use Stillat\BladeParser\Document\Document;
$template = <<<'BLADE'
<x-input-with-slot>
<x-slot class="text-input-lg" name="the_slot_name" data-test="data">Test</x-slot:input>
</x-input-with-slot>
BLADE;
$doc = Document::fromText($template);
$slot = $doc->findComponentByTagName('slot');
// getName() will return a ParameterNode
// in this scenario, allowing us to
// get additional information.
$slot->getName()->value;
This release adds a new getArgValues helper method to the ArgumentGroupNode node. This is similar to the existing getValues() utility method, but is s
This release adds a new getArgValues helper method to the ArgumentGroupNode node. This is similar to the existing getValues() utility method, but is smarter about how it breaks argument strings:
<?php
use Stillat\BladeParser\Document\Document;
use Stillat\BladeParser\Document\DocumentCompilerOptions;
$template = <<<'BLADE'
@js(["one, two", $var1, $var2], $hello, 12345.23, bar, baz, (1,2,3,4,), "foo, bar, baz")
BLADE;
$doc = Document::fromText($template);
// Smartly split the argument string.
$doc->findDirectiveByName('js')
->arguments->getArgValues();
The above sample would produce output similar to the following:
Illuminate\Support\Collection {#2538
all: [
"["one, two", $var1, $var2]",
"$hello",
"12345.23",
"bar",
"baz",
"(1,2,3,4,)",
""foo, bar, baz"",
],
}
This release introduces a new onlyParseComponents method to the DocumentParser class, allowing users to only parse components within an input template
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();
Improves the handling of character offsets when multibyte characters are present in the source template
This release adds a new getValues() method to the Stillat\BladeParser\Nodes\ArgumentGroupNode node, making it easier to work with individual argument
This release adds a new getValues() method to the Stillat\BladeParser\Nodes\ArgumentGroupNode node, making it easier to work with individual argument strings supplied to directives:
<?php
use Stillat\BladeParser\Document\Document;
$template = <<<'BLADE'
@extends("layout")
@section("content")
@lang("arg1")
@endsection
BLADE;
$doc = Document::fromText($template);
$lang = $doc->findDirectiveByName('lang');
// Returns a Collection instance.
$args = $lang->arguments->getValues();
// Returns "arg1"
$value = $args[0];
Corrects behavior of PHP node validation
Corrects some dependency min versions, adds test workflow
Removes use of helper function not available pre Laravel 9.4
BladeCompiler to be safer, and provide "future" defaults when the properties/methods don't exist on the current version (#8 )Nothing published for this version
Improves detection of directives (closes #5 )
Nothing published for this version
One column per quarter.