wutongwan / laravel-lego by YuBing

Yet another CRUD widgets for laravel 5.2+
7,714
110
19
Package Data
Maintainer Username: YuBing
Maintainer Contact: zhwei.yes@gmail.com (zhwei)
Package Create Date: 2016-01-27
Package Last Update: 2023-01-06
Home Page: http://lego.zhw.in
Language: PHP
License: MIT
Last Refreshed: 2024-04-12 03:11:55
Package Statistics
Total Downloads: 7,714
Monthly Downloads: 0
Daily Downloads: 0
Total Stars: 110
Total Watchers: 19
Total Forks: 29
Total Open Issues: 45

Laravel-Lego

Build Status StyleCI Status Latest Stable Version Total Downloads


注意:lego 尚处于开发阶段,1.0版本发布之前主要接口仍有调整的可能性,请注意查看 release note !


Example

  • UserController.php
$form = Lego::form(new User());

$form->addText('number', '编号')->required()->rule('numeric')->unique();
$form->addText('email', '邮箱')->required()->rule('email')->unique();

return $form->view('layout', ['form' => $form]);
  • layout.blade.php
<!doctype html>
<html lang="en">
<head>
    @include('lego::styles')
</head>
<body>

    {!! $form !!}

    @include('lego::scripts')
</body>
</html>

image

Required

  • php >= 7.0 (短时间很多人肯定还没用上 PHP7, But who cares? For a better tomorrow!)
  • Laravel >= 5.2

Installment

1、Composer

composer require "wutongwan/lego"

2、Service Provider (Laravel < 5.5 Only)

Add these lines to providres array of config file config/app.php.

// Lego require LaravelCollective/html ,So need to add it's ServiceProvider.
Collective\Html\HtmlServiceProvider::class,

// Lego require mewebstudio/Purifier ,So need to add it's ServiceProvider.
Mews\Purifier\PurifierServiceProvider::class,

Lego\LegoServiceProvider::class,

Lego require mewebstudio/Purifier , So need to publish it's assets

Visit https://github.com/mewebstudio/Purifier for more detail.

php artisan vendor:publish --provider="Mews\Purifier\PurifierServiceProvider"

3、Publish lego assets

php artisan vendor:publish --tag=lego-assets --force

Tips:

Add to post-update-cmd, In order to update lego static files Automatically.

Documents

Development

  • 静态文件
    • 依赖静态文件需在 bower.json 中配置(暂用 bower ,后期准备换到 npm + laravel-mix)
    • JavaScript
      • 现在项目中并没有固定的技术栈,可以各显神通,mix 应该能满足常见技术栈的编译需求
      • 我比较喜欢 CoffeeScript :)
  • 分支
    • master
      • 在 master 下开发及维护
    • release
      • 发布新版本前由脚本创建,添加了所有依赖的静态文件,方便 composer 安装
  • 当前版本在以下环境中开发并维护
    • Mac
    • Ubuntu

起因

用了快一年的zofe/rapyd-laravel,整体觉得非常好用,但内部确实不少代码年久失修,比较脏,有的组件也不适合中国的情况(比如google map)。

所以我们几个小伙伴想了很久,还是决定重新造个轮子,参考rapyd的思路,做一个我们自己用着更顺手的脚手架库。

起名Lego,也是向乐高致敬,能用简单的Block搭建摩天大厦是我们的梦想。

现在整体代码还是非常初级的版本,有兴趣的朋友欢迎关注以及和我们讨论,但由于整个项目是以提高团队自身效率为最优先前提的,可能我们会独断一些,不会刻意的做的太通用。