php lego 组件,GitHub - zhwei/laravel-lego: 像搭lego积木一样在Laravel中组建你的产品。Inspired by https://github.com/zo...

Laravel-Lego

68747470733a2f2f7472617669732d63692e6f72672f7775746f6e6777616e2f6c61726176656c2d6c65676f2e7376673f6272616e63683d6d6173746572

68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f373534383938362f736869656c643f7374796c653d666c6174266272616e63683d6d6173746572

68747470733a2f2f706f7365722e707567782e6f72672f7775746f6e6777616e2f6c65676f2f76657273696f6e2e706e67

68747470733a2f2f706f7365722e707567782e6f72672f7775746f6e6777616e2f6c65676f2f642f746f74616c2e706e67

注意: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

@include('lego::styles')

{!! $form !!}

@include('lego::scripts')

00cd315f58f98d9f7101e8cfac8bf0f1.png

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

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搭建摩天大厦是我们的梦想。

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值