doob-code/laravel-blade-snippets 问题修复 & 功能扩展

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

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

doob-code/laravel-blade-snippets

最新稳定版本:v1.0.6

Composer 安装命令:

composer require doob-code/laravel-blade-snippets

包简介

A very simple Blade directive to allow components and HTML to be rendered directly to a php variable from within a view.

README 文档

README

A simple Blade directive for Laravel that allows you to render components and HTML directly to a PHP variable from within a Blade view. This is particularly useful for passing dynamic content to Livewire components or other parts of your application.

Installation

You can install the package via Composer:

composer require doob-code/laravel-blade-snippets

Service Provider

This package will automatically register its service provider, but if you need to do it manually, add the service provider to your config/app.php file:

'providers' => [
    // ...
    DoobCode\BladeSnippets\BladeSnippetServiceProvider::class,
],

Usage

Defining Snippets

Use the @snip and @endsnip directives to capture Blade components or HTML into a variable.

Example:

@snip('popoverContent')
    <x-popover>Dynamic section content here</x-popover>
@endsnip

<!-- Pass the $popoverContent variable to a Livewire component -->
@livewire('valuation.next-page-button', [
    'disabled_popover' => $popoverContent,
])

Note on Variables

When using the directives, make sure to provide a variable name without extra quotes. The directive automatically trims surrounding quotes.

License

This package is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a pull request or open an issue for any bugs or enhancements.

Acknowledgments

  • Laravel framework
  • Blade templating engine

统计信息

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

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-18