定制 okipa/laravel-html-helper 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

okipa/laravel-html-helper

最新稳定版本:2.0.0

Composer 安装命令:

composer require okipa/laravel-html-helper

包简介

Useful helpers to dynamically generate clean HTML with Laravel.

README 文档

README

Laravel HTML Helper

Latest Stable Version Total Downloads Build Status Coverage Status License: MIT

⚠️ This package has been abandonned ⚠️

Easily handle conditional HTML generation with the following helpers.

Found this package helpful? Please consider supporting my work!

Donate Donate

Compatibility

Laravel PHP Package
^7.* ^7.4 ^2.0
^5.8 ^7.2 ^1.3
^5.5 ^7.2 ^1.2
^5.5 ^7.1 ^1.0

Upgrade guide

Table of Contents

Installation

  • Install the package with composer:
composer require okipa/laravel-html-helper

API

html_classes

Calling this helper generates an HTML class tag encapsulating the given dynamic classes.

It accepts combination of strings, integers, arrays or null arguments.

@php
    $id = 17;
    $fullScreen = false;
    $darkMode = true;
@endphp
<div{{ html_classes(
    ['card', $id, 'text-left'],
    $fullScreen ? 'full-screen' : null,
    $darkMode ? ['bg-dark', 'text-white'] : null
) }}></div>
<div class="card 17 text-left bg-dark text-white"></div>

You can call app(Okipa\LaravelHtmlHelper\HtmlClasses)->toHtml($classes) if you want to avoid helper use.

html_attributes

Calling this helper generates dynamic HTML attributes, taking care about the given key-only, value-only or key-value combinations.

It accepts combination of strings, arrays or null arguments.

@php
    $dragAndDrop = true;
    $disabled = false;
@endphp
<div{{ html_attributes(
    ['data-confirm' => __('Are you sure you want to delete this line?')],
    $dragAndDrop ? 'data-drag-drop' : null,
    $disabled ? ['disabled', 'data-forbid-click'] : null,
    'required'
) }}></div>
<div data-confirm="Are you sure you want to delete this line?" data-drag-drop required></div>

You can call app(Okipa\LaravelHtmlHelper\HtmlAttributes)->toHtml($attributes) if you want to avoid helper use.

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 53.3k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 5
  • 点击次数: 0
  • 依赖项目数: 4
  • 推荐数: 0

GitHub 信息

  • Stars: 5
  • Watchers: 2
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-06-07