clique-ti/laravel-html
Composer 安装命令:
composer require clique-ti/laravel-html
包简介
Pacote de renderização de HTML para Laravel, com ou sem Livewire.
README 文档
README
Pacote Laravel para renderização simples, fluente e customizável de componentes HTML — compatível tanto com Blade puro quanto com Livewire 3.
Ele facilita o desenvolvimento de interfaces limpas e reutilizáveis, eliminando duplicação de HTML e permitindo composição de componentes de forma elegante, com suporte para atributos dinâmicos, callbacks e views overrideáveis.
Instalação
Via Composer:
composer require cliqueti/html
O pacote utiliza autodiscovery. Nada mais é necessário.
Publicar Views (opcional)
Se quiser personalizar a aparência dos componentes:
php artisan vendor:publish --tag=views --provider="CliqueTi\LaravelHtml\Providers\HtmlProvider"
Isso criará:
resources/views/vendor/cliqueti-html/
Uso dos Componentes
Todos os componentes são acessados via Facade:
{!! Html::input(...) !!} {!! Html::label(...) !!} {!! Html::select(...) !!} {!! Html::selectMultiple(...) !!} {!! Html::checkbox(...) !!} {!! Html::radio(...) !!} {!! Html::textarea(...) !!} {!! Html::button(...) !!} {!! Html::link(...) !!} {!! Html::table(...)->column(...)->make() !!}
Componentes
Label
{!! Html::label(text: 'Nome', attrs: ['class' => 'form-label']) !!}
Input
name é opcional (compatível com Livewire).
{!! Html::input( type: 'text', name: 'name', params: [ 'placeholder' => 'Digite seu nome', 'class' => 'form-control', 'wire:model.live' => 'state.name' ] ) !!}
Textarea
{!! Html::textarea( name: 'obs', value: 'Texto inicial', attrs: ['class' => 'form-control'] ) !!}
Checkbox
{!! Html::checkbox( name: 'active', value: 1, checked: true, attrs: ['class' => 'form-check-input'] ) !!}
Radio
{!! Html::radio( name: 'gender', value: 'M', checkedValue: old('gender'), attrs: ['class' => 'form-check-input'] ) !!}
Select (simples)
{!! Html::select( name: 'status', options: ['Ativo', 'Inativo', 'Pendente'], attrs: ['class' => 'form-select'] ) !!}
Select (associativo com selected)
{!! Html::select( name: 'tipo', options: [ 10 => 'Opção A', 15 => 'Opção B' ], selected: 15 ) !!}
Select com concatenação
{!! Html::select( name: 'user_id', options: \App\Models\User::select('id','name','email')->get(), display: 'name,email', separator: ' - ' ) !!}
Resultado:
Paulo Brandeburski - paulo@cliqueti.com.br
Select Multiple
{!! Html::selectMultiple( name: 'roles', options: $roles, selected: [1, 3], display: 'name', attrs: ['class' => 'form-select'] ) !!}
Link
{!! Html::link( text: 'Editar', href: route('users.edit', $id), attrs: ['class' => 'btn btn-primary'] ) !!}
Button
{!! Html::button( text: 'Salvar', attrs: ['class' => 'btn btn-success', 'wire:click' => 'save'] ) !!}
Tabela (Table Component)
O componente de tabela é poderoso, flexível e fácil de usar.
Exemplo básico
{!! Html::table(data: $users, attrs: ['class' => 'table table-striped']) ->column(header: 'ID', key: 'id') ->column(header: 'Nome', key: 'name') ->column(header: 'Email', key: 'email') ->make() !!}
Acesso seguro a relacionamento
->column(header: 'Time', key: 'team.name')
Mesmo se $user->team for null, nenhum erro é lançado.
Callback para formatação
->column(header: 'Criado em', callback: fn($u) => $u->created_at->format('d/m/Y'))
Callback com componentes HTML
->column(
header: 'Ações',
attrs: ['style' => 'width: 8rem'],
callback: function ($user) {
return Html::link(
text: 'Editar',
href: '#',
attrs: ['class' => 'btn btn-sm btn-primary', 'wire:click' => "edit({$user->id})"]
);
}
)
Exemplo completo em Livewire
Componente:
class Team extends Component { public ?Collection $teams = null; public function mount() { $this->teams = \App\Models\Team::all(); } public function render() { return view('livewire.global.team'); } }
View:
{!! Html::table(data: $teams) ->column(header: 'ID', key: 'id') ->column(header: 'Nome', key: 'name') ->column(header: 'Time', key: 'team.name') ->column(header: 'Ações', callback: fn($t) => Html::link( text: 'Editar', href: '#', attrs: ['wire:click' => "edit({$t->id})", 'class' => 'btn btn-warning btn-sm'] ) ) ->make() !!}
Sobrescrevendo Views
Para personalizar qualquer componente:
- Publique as views:
php artisan vendor:publish --tag=views
- Edite em:
resources/views/vendor/cliqueti-html/
Licença
MIT License.
clique-ti/laravel-html 适用场景与选型建议
clique-ti/laravel-html 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 12 次下载、GitHub Stars 达 1, 最近一次更新时间为 2025 年 12 月 18 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「components」 「html」 「laravel」 「blade」 「livewire」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 clique-ti/laravel-html 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 clique-ti/laravel-html 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 clique-ti/laravel-html 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated again
HTML and form generation
Web Font Loader gives you added control when using linked fonts via @font-face.
A modern HTML DOM parser for PHP using DOMDocument and Symfony CssSelector.
Reusable utilities library for Lacus Solutions' packages (type description, HTML escaping, random sequences)
Ariadne Component Library: xml writer and parser Component
统计信息
- 总下载量: 12
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 10
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-12-18