PHPackages                             red-jasmine/user-core - 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. [Authentication &amp; Authorization](/categories/authentication)
4. /
5. red-jasmine/user-core

ActiveLibrary[Authentication &amp; Authorization](/categories/authentication)

red-jasmine/user-core
=====================

用户通用组件包，提供用户相关的通用功能和组件

1.0.13(5mo ago)0432MITPHP

Since Jan 20Pushed 5mo agoCompare

[ Source](https://github.com/red-jasmine/user-core)[ Packagist](https://packagist.org/packages/red-jasmine/user-core)[ Docs](https://github.com/red-jasmine/user-core)[ RSS](/packages/red-jasmine-user-core/feed)WikiDiscussions master Synced today

READMEChangelogDependencies (4)Versions (15)Used By (2)

用户通用组件包 (User Common Package)
=============================

[](#用户通用组件包-user-common-package)

简介
--

[](#简介)

用户通用组件包是一个基于 Red Jasmine Framework 的用户相关通用功能组件，提供用户资料管理、头像上传、资料完整度检查等通用功能。

功能特性
----

[](#功能特性)

- **用户资料管理**: 提供完整的用户资料管理功能
- **头像上传**: 支持用户头像上传和管理
- **资料完整度**: 自动计算用户资料完整度
- **偏好设置**: 支持用户个性化偏好设置
- **多语言支持**: 内置中文语言包
- **RESTful API**: 提供完整的 RESTful API 接口

安装
--

[](#安装)

```
composer require red-jasmine/user-common
```

配置
--

[](#配置)

发布配置文件：

```
php artisan vendor:publish --tag=user-common-config
```

使用方法
----

[](#使用方法)

### API 接口

[](#api-接口)

#### 获取用户资料

[](#获取用户资料)

```
GET /api/user-common/profile
```

#### 更新用户资料

[](#更新用户资料)

```
PUT /api/user-common/profile
Content-Type: application/json

{
    "nickname": "新昵称",
    "realname": "真实姓名",
    "gender": "male",
    "biography": "个人介绍"
}
```

#### 上传头像

[](#上传头像)

```
POST /api/user-common/profile/avatar
Content-Type: multipart/form-data

avatar: [文件]
```

#### 获取资料完整度

[](#获取资料完整度)

```
GET /api/user-common/profile/completion
```

### 服务使用

[](#服务使用)

```
use RedJasmine\UserCommon\Application\Services\UserCommonApplicationService;

$service = app(UserCommonApplicationService::class);

// 获取用户资料
$profile = $service->getProfile($query);

// 更新用户资料
$profile = $service->updateProfile($command);

// 获取资料完整度
$completion = $service->getProfileCompletion($query);
```

配置选项
----

[](#配置选项)

在 `config/user-common.php` 中可以配置以下选项：

- `features`: 功能开关配置
- `upload`: 文件上传配置
- `cache`: 缓存配置
- `validation`: 验证规则配置

数据库迁移
-----

[](#数据库迁移)

运行数据库迁移：

```
php artisan migrate
```

语言包
---

[](#语言包)

发布语言文件：

```
php artisan vendor:publish --tag=user-common-lang
```

视图文件
----

[](#视图文件)

发布视图文件：

```
php artisan vendor:publish --tag=user-common-views
```

开发
--

[](#开发)

### 运行测试

[](#运行测试)

```
composer test
```

### 代码格式化

[](#代码格式化)

```
composer format
```

### 静态分析

[](#静态分析)

```
composer analyse
```

许可证
---

[](#许可证)

MIT License

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance72

Regular maintenance activity

Popularity8

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 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 ~0 days

Total

13

Last Release

163d ago

### Community

Maintainers

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

---

Top Contributors

[![liushoukun](https://avatars.githubusercontent.com/u/26298472?v=4)](https://github.com/liushoukun "liushoukun (3 commits)")

---

Tags

laravelusercorered-jasmineuser-core

### Embed Badge

![Health badge](/badges/red-jasmine-user-core/health.svg)

```
[![Health](https://phpackages.com/badges/red-jasmine-user-core/health.svg)](https://phpackages.com/packages/red-jasmine-user-core)
```

###  Alternatives

[lab404/laravel-impersonate

Laravel Impersonate is a plugin that allows to you to authenticate as your users.

2.3k18.6M64](/packages/lab404-laravel-impersonate)[klaravel/ntrust

Role-Based Permissions for Laravel 5.3+

10026.8k1](/packages/klaravel-ntrust)[hapidjus/laravel-impersonate-ui

UI for 404labfr/laravel-impersonate

371.6k](/packages/hapidjus-laravel-impersonate-ui)[torann/promise

Simple Roles and Permissions for Laravel 5.

131.1k](/packages/torann-promise)

PHPackages © 2026

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