PHPackages                             cimple-admin/forms - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. cimple-admin/forms

ActiveLibrary[Admin Panels](/categories/admin)

cimple-admin/forms
==================

form builder for laravel

v0.2.11(3y ago)022MITPHP

Since Nov 18Pushed 3y ago1 watchersCompare

[ Source](https://github.com/cimple-admin/forms)[ Packagist](https://packagist.org/packages/cimple-admin/forms)[ RSS](/packages/cimple-admin-forms/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (10)Dependencies (2)Versions (20)Used By (0)

livewire 表单构造器
--------------

[](#livewire-表单构造器)

这是一个基于 [livewire](https://laravel-livewire.com/) 的 [laravel](https://laravel.com/) 表单构造器。

前端基于 [AdminLTE](https://adminlte.io/)

[![Security Status](https://camo.githubusercontent.com/fd59c1baaec28c64e4f514af6d72d47581dfc595a40bf521e37573528ce7e8a5/68747470733a2f2f7777772e6d75727068797365632e636f6d2f706c6174666f726d332f76332f62616467652f313631313434313239393436333337323830302e7376673f743d31)](https://www.murphysec.com/accept?code=5607fe9d76703e206fe71e9aa0f45ca1&type=1&from=2&t=2)

### 如何使用

[](#如何使用)

> 项目目前还处于开发期，变动会很大，不建议在生产环境中使用。
>
> 使用本扩展需要对 [livewire](https://laravel-livewire.com/) 有足够的了解。

#### 在新项目中安装

[](#在新项目中安装)

1. 创建 laravel 项目后，安装扩展 `composer require cimple-admin/forms`
2. ` ./vendor/bin/sail artisan vendor:publish --tag=cimple-form --force`使用这个命令把资源文件复制到自己的项目中，注意这个命令适合全新项目使用，如果是混合项目，则可以去 `provider`里面看下需要什么再复制对应资源，尤其是 layout 不要覆盖了。
3. 安装后就可以使用 `artisan make:livewire XXX` 命令来创建自己的组件了。
4. 引入 `HasFormTrait`。只需实现一个方法 `getForm`

    ```
    namespace App\Http\Livewire;

    use Illuminate\Validation\Rules\Password;
    use JetBrains\PhpStorm\NoReturn;
    use Livewire\Component;
    use CimpleAdmin\Forms\Builder\TextInput;
    use CimpleAdmin\Forms\Builder\PasswordInput;
    use CimpleAdmin\Forms\Builder\CheckList;
    use CimpleAdmin\Forms\Builder\CheckBox;
    use CimpleAdmin\Forms\Builder\Select;
    use CimpleAdmin\Forms\Builder\SelectMulti;
    use CimpleAdmin\Forms\Builder\Radio;
    use CimpleAdmin\Forms\Builder\Textarea;
    use CimpleAdmin\Forms\Builder\WangEditor;
    use CimpleAdmin\Forms\Builder\FileUploader;
    use CimpleAdmin\Forms\HasForm;
    use CimpleAdmin\Forms\Traits\HasFormTrait;

    class Test1 extends Component
    {
    use HasFormTrait;

        public string $title = "test page title";

        public string $email = 'abc';
        public string $password;
        public string $username = 'df fdasfs';
        public array  $hobby;
        public bool   $remember = false;
        public string $tel;
        public string $sex;
        public string $intro;

        public string|array $interest;
        public string       $interest2;
        public string       $content1;
        public string       $content2;
        public array $pic = ['c9fe0330-3d8f-4ead-9b99-144e7e35a734.pdf', '671c09c8-e6d4-4440-a5ac-4c99744a5daf.jpg'];
        public array $pic2;

        public function render()
        {
            return view('livewire.test1');
        }

        public function getForm(): array
        {
            return [
                TextInput::make('email')->label("电子邮件")->required()->email()->hint("this is text input hint"),
                TextInput::make('username')->label("用户名")->required()->alphaDash(),
    //            TextInput::make('tel')->label("手机号")->required()->type('tel'),
    //            PasswordInput::make('password')->label("密码")->required()->rules([
    //                Password::min(10)->letters()->numbers()->mixedCase()->symbols(),
    //            ])->hint("密码必须包含大写字母、小写字母、符号以及数字，最少10位"),
    //            CheckList::make('hobby')->label('爱好')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInArray(['football']),
    //            CheckBox::make('remember')->label('记住我')->toggle()->hiddenLabel(),
    //            Radio::make('sex')->label('性别')->options([
    //                'male' => '男',
    //                'female' => '女',
    //                'other' => '未知',
    //            ])->required()->itemInOption(),
    //            SelectMulti::make('interest')->label('爱好2')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInOption()->inline(),
    //            Select::make('interest2')->label('爱好3')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInOption()->inline(),
    Textarea::make('intro')->label('简介')->rows(8)->inline(),
    //            WangEditor::make('content1')->label('内容1'),
    //            WangEditor::make('content2')->label('内容2')->inline(),
    FileUploader::make('pic')->label('封面图片')->maxFileSize(1000 * 1024 * 1024)->autoUpload(true),
    //FileUploader::make('pic2')->label('封面图片2')->maxFileSize(1000 * 1024 * 1024)->autoUpload(false),
    ];
    }

        #[NoReturn] public function submit()
        {
            $this->validate();
            dd('pass validate', $this->content1, $this->username, $this->email);
        }
    }
    ```
5. 这个方法返回了，一批表单组件。

    ```
    public function getForm()
    {
        return [
                TextInput::make('email')->label("电子邮件")->required()->email()->hint("this is text input hint"),
                TextInput::make('username')->label("用户名")->required()->alphaDash(),
    //            TextInput::make('tel')->label("手机号")->required()->type('tel'),
    //            PasswordInput::make('password')->label("密码")->required()->rules([
    //                Password::min(10)->letters()->numbers()->mixedCase()->symbols(),
    //            ])->hint("密码必须包含大写字母、小写字母、符号以及数字，最少10位"),
    //            CheckList::make('hobby')->label('爱好')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInArray(['football']),
    //            CheckBox::make('remember')->label('记住我')->toggle()->hiddenLabel(),
    //            Radio::make('sex')->label('性别')->options([
    //                'male' => '男',
    //                'female' => '女',
    //                'other' => '未知',
    //            ])->required()->itemInOption(),
    //            SelectMulti::make('interest')->label('爱好2')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInOption()->inline(),
    //            Select::make('interest2')->label('爱好3')->options([
    //                'football' => '足球',
    //                'swaming' => '游泳',
    //                'basketball' => '篮球',
    //            ])->required()->itemInOption()->inline(),
    Textarea::make('intro')->label('简介')->rows(8)->inline(),
    //            WangEditor::make('content1')->label('内容1'),
    //            WangEditor::make('content2')->label('内容2')->inline(),
    FileUploader::make('pic')->label('封面图片')->maxFileSize(1000 * 1024 * 1024)->autoUpload(true),
    //FileUploader::make('pic2')->label('封面图片2')->maxFileSize(1000 * 1024 * 1024)->autoUpload(false),
    ];
    }
    ```
6. 页面模板

    ```

      {{-- If your happiness depends on money, you will never be happy with yourself. --}}
      {{$this->form}}
      submit

    @section('title')
        {{$title}}
    @endsection
    ```

    只要增加 `{{$this->form}}` 就可以显示出来再代码中定义的组件了 至于 button 就是自己实现提交逻辑的方法了，这个库只生成表单，其他的都要自己实现，后续的更多支持，可以期待后续的库
7. 至此，全部都结束了。只需在代码里面定义表单和提交逻辑，前端部分几乎什么都不需要了。

### 初步完成组件

[](#初步完成组件)

- input
- password
- checkbox
- checklist
- radio
- textarea
- select
- wangeditor
- fileupload (dropzone)

上面这些仅仅是功能完成了，后续还有抽象、样式优化、功能细节优化等持续功能要做

### 待增加组件

[](#待增加组件)

- editor ( editor.md 、 ueditorplus(这个待考虑))

### 更多说明

[](#更多说明)

1. 还在初期，改动很大，不要生产环境
2. 参考了很多  的逻辑，代码是否有交叉未知。

###  Health Score

22

—

LowBetter than 22% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 97.7% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~5 days

Total

19

Last Release

1189d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/29fd3a996c0bf8a7b96c50e1ba34d579fbb19e44248e3b1342448e84eff4a86c?d=identicon)[crazyhl](/maintainers/crazyhl)

---

Top Contributors

[![crazyhl](https://avatars.githubusercontent.com/u/5474833?v=4)](https://github.com/crazyhl "crazyhl (213 commits)")[![StyleCIBot](https://avatars.githubusercontent.com/u/11048387?v=4)](https://github.com/StyleCIBot "StyleCIBot (5 commits)")

---

Tags

laravellivewire

### Embed Badge

![Health badge](/badges/cimple-admin-forms/health.svg)

```
[![Health](https://phpackages.com/badges/cimple-admin-forms/health.svg)](https://phpackages.com/packages/cimple-admin-forms)
```

###  Alternatives

[power-components/livewire-powergrid

PowerGrid generates Advanced Datatables using Laravel Livewire.

1.7k1.7M6](/packages/power-components-livewire-powergrid)[filament/support

Core helper methods and foundation code for all Filament packages.

2323.9M151](/packages/filament-support)[litstack/litstack

Laravel Content-Administration

86132.5k8](/packages/litstack-litstack)[guava/filament-nested-resources

162172.1k2](/packages/guava-filament-nested-resources)[andreia/filament-ui-switcher

Add a modal with options to switch between different UI layouts and styles (colors, fonts, font sizes).

233.8k](/packages/andreia-filament-ui-switcher)[a2insights/filament-saas

Filament Saas for A2Insights

161.1k](/packages/a2insights-filament-saas)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
