steelants/form
Composer 安装命令:
composer require steelants/form
包简介
Simple Form Builder class based on Laravel & Bootstrap 5
README 文档
README
Livewire compatible form elements. Styled with Bootstrap 5.
Currently WIP
Created by: SteelAnts s.r.o.
Installation
npm|pnpm|bun i quill quill-table-ui quill-mention
Include scripts
app.js
import './quill';
app.scss
import "./quill";
Examples
Form
Attributes:
- action
- method
<x-form::form method="DELETE" action="action-url"> ... </x-form::form> <x-form::form wire:submit="save"> ... </x-form::form>
Automatically inserts _method and _token base on method attribute
<form enctype="multipart/form-data" action="action-url" method="POST"> <input type="hidden" name="_token" value="xxxxxxxx" autocomplete="off"> <input type="hidden" name="_method" value="DELETE"> ... </form> <form wire:submit="save" enctype="multipart/form-data"> ... </form>
Input
Attributes:
- name - Input name (required for non-livewire use)
- label - Input label (optional)
- help - Help text
- group-class - Class of wrapping element
- value - value
<x-form::input group-class="mb-3" type="text" name="test" id="xxxx" label="Basic input" placeholder="This is placeholder" help="Help text is here"/> <x-form::input type="text" wire:model="test" label="Livewire input"/>
Select
Attributes:
- name - Input name (required for non-livewire use)
- label - Input label (optional)
- help - Help text
- group-class - Class of wrapping element
- options - Array of values
- value - Selected value (for non-livewire use)
- placeholder - Placeholder (hidden option withou value)
- value - value
@php $options = [ 1 => 'one', 2 => 'two', 3 => 'three', ]; @endphp <x-form::select wire:model="select" group-class="mb-3" label="Livewire Select" :options="$options" placeholder="Select value..."/> <x-form::select name="select" group-class="mb-3" label="Basic Select" value="2" :options="$options" placeholder="Select value..."/>
Textarea
Attributes:
- name - Input name (required for non-livewire use)
- label - Input label (optional)
- help - Help text
- group-class - Class of wrapping element
- value - value
<x-form::textarea wire:model="textarea"/>
Quill
- name - Input name (required for non-livewire use)
- label - Input label (optional)
- help - Help text
- group-class - Class of wrapping element
- mentions - Users for @ mentions. (see quill-mention package for more info)
- tags - Hashtags (see quill-mention package for more info)
<x-form::quill group-class="mb-3" label="Quill" name="quill" value="This is init value from html" :mentions="[{id: 1, value: 'SteelAnts'}]" :tags="[{id: 1, value: 'Laravel'}]" /> <x-form::quill group-class="mb-3" label="Quill" wire:model="quill" />
Button
<x-form::button class="btn-primary" type="submit">submit</x-form::button>
Notes
- Non-livewire elment require
nameattribute - Livewire element require
wire:model*attribute. - Values are inserted with
old() - All attributes are passed down to input/select/texarea element.
Development
-
Create subfolder
/packagesat root of your laravel project -
clone repository to sub folder
/packages(you need to be positioned at root of your laravel project in your terminal)
git clone https://github.com/steelants/Laravel-Form.git ./packages/Laravel-Form
- edit composer.json file
"autoload": { "psr-4": { "SteelAnts\\Form\\": "packages/Laravel-Form/src/", } }
- Add provider to
bootstrap/providers.php
return [ ... SteelAnts\Form\FormServiceProvider ::class, ... ];
Contributors
Other Packages
steelants/form 适用场景与选型建议
steelants/form 是一款 基于 Blade 开发的 Composer 扩展包,目前已累计 3.3k 次下载、GitHub Stars 达 1, 最近一次更新时间为 2023 年 09 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 steelants/form 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 steelants/form 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 3.3k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 7
- 依赖项目数: 2
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-09-20