PHPackages                             seffeng/lumen-basics - 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. seffeng/lumen-basics

ActiveLibrary

seffeng/lumen-basics
====================

Lumen extension basics

v2.0.2(2y ago)03.1k↓100%MITPHPPHP &gt;=7.2.5

Since Jul 6Pushed 2y ago1 watchersCompare

[ Source](https://github.com/seffeng/lumen-basics)[ Packagist](https://packagist.org/packages/seffeng/lumen-basics)[ Docs](https://github.com/seffeng/lumen-basics)[ RSS](/packages/seffeng-lumen-basics/feed)WikiDiscussions master Synced today

READMEChangelog (10)Dependencies (3)Versions (28)Used By (0)

Lumen Basics
------------

[](#lumen-basics)

### 安装

[](#安装)

```
# lumen7、lumen8
$ composer require seffeng/lumen-basics

# lumen6
$ composer require seffeng/lumen-basics=^0.*
```

### 目录说明

[](#目录说明)

```
├─Base                      基础类
│   Controller.php              控制器
│   FormRequest.php             表单验证
│   Model.php                   数据库
│   Response.php                响应
│   Service.php                 服务
├─Constants                 常量定义
│   DeleteConst.php             删除
│   ErrorConst.php              错误
│   StatusConst.php             状态
│   TypeConst.php               类型
├─Exceptions                异常
│   BaseException.php           异常
│   Handler.php                 异常处理器
└─Rules                     验证规则
    Password.php                密码
    Phone.php                   手机号

```

### 示例

[](#示例)

```
/**
 * TestRequest.php
 * 表单验证示例
 */
namespace App\Http\Requests;

use Seffeng\Basics\Base\FormRequest;
use Seffeng\Basics\Rules\Phone;

class TestRequest extends FormRequest
{
    protected $fillable = ['phone', 'password'];

    public function rules()
    {
        return [
            'phone' => [
                'required',
                new Phone()
            ],
            'password' => 'required'
        ];
    }

    public function messages()
    {
        return array_merge(parent::messages(), [

        ]);
    }

    public function attributes()
    {
        return array_merge(parent::attributes(), [
            'phone' => '手机号',
            'password' => '密码',
        ]);
    }
}

/**
 * TestController.php
 * 表单验证示例 - 控制器
 */
namespace App\Http\Controllers;

use Illuminate\Support\Facades\Validator;
use Seffeng\Basics\Base\Controller;
use Illuminate\Http\Request;
use App\Http\Requests\TestRequest;

class TestController extends Controller
{
    public function index(Request $request)
    {
        $form = new TestRequest();
        $data = $form->load($request->all());
        $validator = Validator::make($data, $form->rules(), $form->messages(), $form->attributes());
        $errors = $form->getErrorItems($validator);
        if ($form->getIsPass()) {
            return $this->responseSuccess($form->getFillItems());
        }
        return $this->responseError($errors['message'], $errors['data']);
    }
}
```

```
// 验证成功
{
    "status": "success",
    "data": {
        "phone": "13800138000",
        "password": "123456"
    },
    "message": "success"
}
// 验证失败
{
    "status": "error",
    "code": 1,
    "data": {
        "phone": [
            "手机号格式错误！"
        ],
        "password": [
            "密码不能为空！"
        ]
    },
    "message": "手机号格式错误！ 密码不能为空！"
}
```

### 更新日志

[](#更新日志)

[changelog](CHANGELOG.md)

###  Health Score

30

—

LowBetter than 67% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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 ~44 days

Recently: every ~157 days

Total

27

Last Release

944d ago

Major Versions

v0.1.3 → v1.1.52021-03-22

v0.2.0 → v1.2.02021-06-21

v0.2.1 → v1.2.12021-10-13

v0.2.2 → v1.2.32021-12-01

v1.2.3 → v2.0.02022-07-01

PHP version history (4 changes)v1.0.0PHP ^7.2.5

v0.1.0PHP ^7.1.3

v1.2.2PHP &gt;=7.2.5

0.x-devPHP &gt;=7.1.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/30b3d8cc986a1ad37a55169b11812fea1cae31430dd8dbe1b3436dc58cc885bd?d=identicon)[seffeng](/maintainers/seffeng)

---

Top Contributors

[![seffeng](https://avatars.githubusercontent.com/u/3509779?v=4)](https://github.com/seffeng "seffeng (25 commits)")

---

Tags

lumenseffengbasics

### Embed Badge

![Health badge](/badges/seffeng-lumen-basics/health.svg)

```
[![Health](https://phpackages.com/badges/seffeng-lumen-basics/health.svg)](https://phpackages.com/packages/seffeng-lumen-basics)
```

###  Alternatives

[darkaonline/swagger-lume

OpenApi or Swagger integration to Lumen

3342.3M3](/packages/darkaonline-swagger-lume)[pearl/lumen-request-validate

Lumen doesn't have form request validator seperatly. This package helps developers to segregate the validation layer from the controller to a separate dedicated class

45387.0k2](/packages/pearl-lumen-request-validate)[vluzrmos/collective-html

LaravelCollective Html and Form builder for Lumen.

2523.9k](/packages/vluzrmos-collective-html)

PHPackages © 2026

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