PHPackages                             sentsin/layui - 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. [Framework](/categories/framework)
4. /
5. sentsin/layui

ActiveLibrary[Framework](/categories/framework)

sentsin/layui
=============

采用自身模块规范编写的前端 UI 框架，遵循原生 HTML/CSS/JS 的书写形式，极低门槛，拿来即用。

09JavaScript

Since Nov 6Pushed 7y ago1 watchersCompare

[ Source](https://github.com/laravelfy/layui)[ Packagist](https://packagist.org/packages/sentsin/layui)[ RSS](/packages/sentsin-layui/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

 [ ![layui](https://camo.githubusercontent.com/8603edcf6e900f8b86cc1ed0ba9580e85c42ba941b499d14d22f396a2f269a06/68747470733a2f2f73656e7473696e2e67697465652e696f2f7265732f696d616765732f6c617975692f6c617975692e706e67) ](http://www.layui.com)

 Classic modular front-end UI framework

 [![Build Status](https://camo.githubusercontent.com/d89dbc271e690e0d2e3af60168a6fe3223e65741cafb09f656d4ac715ca50a63/68747470733a2f2f696d672e736869656c64732e696f2f7472617669732f73656e7473696e2f6c617975692f6d61737465722e737667)](https://travis-ci.org/sentsin/layui) [![Build Status](https://camo.githubusercontent.com/8842d81e1442ab8bfea1dd21c541d0a085f9df2691518b11f9c18487ba7105f0/68747470733a2f2f73617563656c6162732e636f6d2f6275696c647374617475732f6c61797569)](https://saucelabs.com/beta/builds/7e6196205e4f492496203388fc003b65) [![Test Coverage](https://camo.githubusercontent.com/89cad0fac6dc449e79d4b55332ab29933dc5b71acb48e0be9c8b7ad11f2ab646/68747470733a2f2f696d672e736869656c64732e696f2f636f766572616c6c732f73656e7473696e2f6c617975692f6d61737465722e737667)](https://coveralls.io/r/sentsin/layui?branch=master)

 [![Browser Matrix](https://camo.githubusercontent.com/ba6f76e56e21907883b42c035200acd48779cdc64314f11dc7f723841f461058/68747470733a2f2f73617563656c6162732e636f6d2f62726f777365722d6d61747269782f6c617975692e737667)](https://saucelabs.com/beta/builds/7e6196205e4f492496203388fc003b65)

---

layui 是一款采用自身模块规范编写的情怀型前端UI框架，遵循原生HTML/CSS/JS的书写与组织形式，门槛极低，拿来即用。其外在极简，却又不失饱满的内在，体积轻盈，组件丰盈，从核心代码到API的每一处细节都经过精心雕琢，非常适合界面的快速开发。layui 首个版本发布于2016年金秋，她区别于那些基于MVVM底层的UI框架，却并非逆道而行，而是信奉返璞归真之道。准确地说，她更多是为服务端程序员量身定做，你无需涉足各种前端工具的复杂配置，只需面对浏览器本身，让一切你所需要的元素与交互，从这里信手拈来。

返璞归真
----

[](#返璞归真)

layui 定义为“经典模块化”，并非是自吹她自身有多优秀，而是有意避开当下JS社区的主流方案，试图以最简单的方式去诠释高效！*她的所谓经典，是在于对返璞归真的执念*，她以当前浏览器普通认可的方式去组织模块！我们认为，这恰是符合当下国内绝大多数程序员从旧时代过渡到未来新标准的最佳指引。所以 layui 本身也并不是完全遵循于AMD时代，准确地说，她试图建立自己的模式，所以你会看到：

```
//layui模块的定义
layui.define([mods], function(exports){

  //……

  exports('mod', api);
});

//layui模块的使用
layui.use(['mod1', 'mod2'], function(args){
  var mod = layui.mod1;

  //……

});
```

没错，她具备AMD的影子，又并非受限于commonjs的那些条条框框，layui 认为这种轻量的组织方式，比WebPack更符合绝大多数场景。所以她坚持采用经典模块化，也正是能让人避开工具的复杂配置，回归简单，安静高效地撸一会原生态的HTML、CSS、JavaScript。

但是 layui 又并非是Requirejs那样的模块加载器，而是一款UI解决方案，她与Bootstrap最大的不同恰恰在于她糅合了自身对经典模块化的理解。

快速上手
----

[](#快速上手)

获得 layui 后，将其完整地部署到你的项目目录（或静态资源服务器），你只需要引入下述两个文件：

```
./layui/css/layui.css
./layui/layui.js //提示：如果是采用非模块化方式（最下面有讲解），此处可换成：./layui/layui.all.js

```

不用去管其它任何文件。因为他们（比如各模块）都是在最终使用的时候才会自动加载。这是一个基本的入门页面：

```
>

  开始使用layui

//一般直接写在一个js文件中
layui.use(['layer', 'form'], function(){
  var layer = layui.layer
  ,form = layui.form;

  layer.msg('Hello World');
});

```

如果你想采用非模块化方式（即所有模块一次性加载，尽管我们并不推荐你这么做），你也可以按照下面的方式使用：

```
>

  非模块化方式使用layui

//由于模块都一次性加载，因此不用执行 layui.use() 来加载对应模块，直接使用即可：
;!function(){
  var layer = layui.layer
  ,form = layui.form;

  layer.msg('Hello World');
}();

```

[阅读文档](http://www.layui.com/)
-----------------------------

[](#阅读文档)

从现在开始，尽情地拥抱 layui 吧！但愿她能成为你长远的开发伴侣，化作你方寸屏幕前的亿万字节！

相关
--

[](#相关)

[官网](http://www.layui.com/)、[更新日志](http://www.layui.com/doc/base/changelog.html)、[社区交流](http://fly.layui.com)

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community17

Small or concentrated contributor base

Maturity39

Early-stage or recently created project

 Bus Factor2

2 contributors hold 50%+ of commits

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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/e66e746f168551b6b3d2a83b594105b78a43bff3646730f15725fd7b515eaff3?d=identicon)[xiaohuilam](/maintainers/xiaohuilam)

---

Top Contributors

[![xuexb](https://avatars.githubusercontent.com/u/3872051?v=4)](https://github.com/xuexb "xuexb (39 commits)")[![star1029](https://avatars.githubusercontent.com/u/38647375?v=4)](https://github.com/star1029 "star1029 (23 commits)")[![smallweis](https://avatars.githubusercontent.com/u/20886521?v=4)](https://github.com/smallweis "smallweis (9 commits)")[![xiaohuilam](https://avatars.githubusercontent.com/u/6964962?v=4)](https://github.com/xiaohuilam "xiaohuilam (4 commits)")[![weianguo](https://avatars.githubusercontent.com/u/2612973?v=4)](https://github.com/weianguo "weianguo (3 commits)")[![fonqing](https://avatars.githubusercontent.com/u/25915782?v=4)](https://github.com/fonqing "fonqing (2 commits)")[![wanzhende](https://avatars.githubusercontent.com/u/22611467?v=4)](https://github.com/wanzhende "wanzhende (2 commits)")[![phy25](https://avatars.githubusercontent.com/u/331403?v=4)](https://github.com/phy25 "phy25 (2 commits)")[![zjpzjp](https://avatars.githubusercontent.com/u/11382248?v=4)](https://github.com/zjpzjp "zjpzjp (1 commits)")[![bale836](https://avatars.githubusercontent.com/u/13298918?v=4)](https://github.com/bale836 "bale836 (1 commits)")[![joviqiao](https://avatars.githubusercontent.com/u/13116366?v=4)](https://github.com/joviqiao "joviqiao (1 commits)")[![luckxu](https://avatars.githubusercontent.com/u/17664219?v=4)](https://github.com/luckxu "luckxu (1 commits)")[![YiiGuxing](https://avatars.githubusercontent.com/u/10737066?v=4)](https://github.com/YiiGuxing "YiiGuxing (1 commits)")[![yoder](https://avatars.githubusercontent.com/u/512680?v=4)](https://github.com/yoder "yoder (1 commits)")[![a-wing](https://avatars.githubusercontent.com/u/18189138?v=4)](https://github.com/a-wing "a-wing (1 commits)")

### Embed Badge

![Health badge](/badges/sentsin-layui/health.svg)

```
[![Health](https://phpackages.com/badges/sentsin-layui/health.svg)](https://phpackages.com/packages/sentsin-layui)
```

###  Alternatives

[laravel/telescope

An elegant debug assistant for the Laravel framework.

5.2k67.8M192](/packages/laravel-telescope)[spiral/roadrunner

RoadRunner: High-performance PHP application server and process manager written in Go and powered with plugins

8.4k12.2M84](/packages/spiral-roadrunner)[nolimits4web/swiper

Most modern mobile touch slider and framework with hardware accelerated transitions

41.8k177.2k1](/packages/nolimits4web-swiper)[laravel/dusk

Laravel Dusk provides simple end-to-end testing and browser automation.

1.9k36.7M259](/packages/laravel-dusk)[laravel/prompts

Add beautiful and user-friendly forms to your command-line applications.

708181.8M596](/packages/laravel-prompts)[cakephp/chronos

A simple API extension for DateTime.

1.4k47.7M121](/packages/cakephp-chronos)

PHPackages © 2026

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