Giter Club home page Giter Club logo

laravel-lego's Introduction

Laravel-Lego

Build 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 ? 一切向前看!)
  • Laravel >= 5.2

Installment

1、使用 Composer 添加依赖

composer require wutongwan/lego

2、添加 Service Provider ,将下面的内容添加到 config/app.phpproviders 数组中

// Lego 依赖 LaravelCollective/html ,所以同时需要添加其 ServiceProvider .
Collective\Html\HtmlServiceProvider::class,

Lego\LegoServiceProvider::class,

3、发布项目相关文件

本项目使用 bower 管理静态文件,执行下面命令前,请确认已安装 bower

# 1、发布配置文件
php artisan vendor:publish --provider="Lego\LegoServiceProvider"

# 2、使用 bower 更新静态文件并发布
php artisan lego:update-components
# 如果当前用户为 root
php artisan lego:update-components --bower-allow-root

4、仅开发环境

  • IDE Helper

    为方便调用 widget 中的 addField 系列函数,推荐执行下面命令,该命令会在项目根目录创建 _ide_helper_lego.php 文件,方便 IDE 进行自动补全.

     php artisan lego:generate-ide-helper

文档

当前版本在以下环境中开发并维护

  • Mac、Ubuntu

起因

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

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

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

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

laravel-lego's People

Contributors

zhwei avatar icedfish avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.