stillat/blade-parser 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

stillat/blade-parser

最新稳定版本:v2.0.0

Composer 安装命令:

composer require stillat/blade-parser

包简介

无描述信息

README 文档

README

Blade Parser is library for Laravel that makes it easy to parse, analyze, and manipulate Blade templates.

The library is composed of many major components:

  • Parser: A Blade parser that produces a list of nodes, which can be analyzed to help make decisions surrounding a template.
  • Documents: A powerful abstraction that makes it much simpler to interact with the details of a single parsed Blade template.
  • Workspaces: A simple set of APIs that make it effortless to work with multiple parsed Blade templates at once.
  • Compiler: A highly configurable Blade compiler implementation, with support for precompilers, extensions, and existing third-party packages.
  • Validator: An extensible system for validating Blade documents, with default validators capable of detecting unpaired conditions, invalid component parameter spacing, and much more.

Simple to Use

Parsing Blade templates is incredibly simple using the Documents API. As an example, this is all that is needed to parse a template:

<?php
 
use Stillat\BladeParser\Document\Document;
 
$template = <<<'BLADE'
    Hello, {{ $world }}
BLADE;
 
$document = Document::fromText($template);

The Document class provides a powerful abstraction, making it simple to quickly retrieve information about a template.

For instance, if we wanted to extract all the components from our template we could do this:

<?php

// Do something with all component tags in the template.
$document->getComponents()
          ->each(fn($node) => ...);

If we were only interested in a component named alert, we could instead use:

<?php

// Find all "alert" components.
$document->findComponentsByTagName('alert')
         ->each(fn($node) => ...);

These examples hardly scratch the surface, and you are encouraged to read through the Documentation.

Built-in Validation Command

This library also ships with a configurable blade:validate Artisan command which can be used to validate all Blade templates within a project.

To configure the command, you will need to publish its configuration files using the following command:

php artisan vendor:publish --tag=blade

To run the validation against your project, you can issue the following Artisan command:

php artisan blade:validate

If any validation issues were detected they will be displayed in your terminal.

There are many configuration options available, and if you'd like to learn more you can find them documented in the Configuring the Validate Command article.

License

This parser library is open-sourced software licensed under the MIT license.

统计信息

  • 总下载量: 914.37k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 143
  • 点击次数: 1
  • 依赖项目数: 9
  • 推荐数: 0

GitHub 信息

  • Stars: 143
  • Watchers: 3
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-04

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固