PHPackages                             swap-cloud/custom-extend - 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. swap-cloud/custom-extend

ActiveLibrary

swap-cloud/custom-extend
========================

基于owl-admin和amis的底层自定义拓展

09PHP

Since Mar 4Pushed 2mo agoCompare

[ Source](https://github.com/swap-cloud/custom-extend)[ Packagist](https://packagist.org/packages/swap-cloud/custom-extend)[ RSS](/packages/swap-cloud-custom-extend/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

SwapCloud Custom Extend
=======================

[](#swapcloud-custom-extend)

中继 owl-admin、增加自定义组件的扩展包。

安装
--

[](#安装)

```
composer require swap-cloud/custom-extend
```

快速开始
----

[](#快速开始)

为了方便初学者避免遇到 PHP 扩展以及配置问题，推荐使用 docker-compose 作为环境编排。

1. **发布配置**

```
php artisan publish:docker
```

2. **启动环境**

```
docker-compose up -d
```

> 提示：
>
> - 进入容器终端: `docker-compose exec api bash`
> - 修改端口: 编辑 `docker-compose.yml` 中 `nginx` 服务的 `ports` 配置。

功能文档
----

[](#功能文档)

本扩展提供了多种增强功能，详细使用说明请参考以下文档：

- **[Swoole 协程队列 (SwooleWork)](docs/swoole-work.md)**: 利用 Swoole 协程实现高并发队列处理，支持独立的协程数据库连接管理。
- **服务提供者扩展**: 解决字典自动加载及 Migration 问题。
- **API 路由与响应**: 快速定义 API 路由及统一 JSON 响应。
- **公共函数库**: 提供常用的辅助函数。
- **LaravelSwoole 支持**: 集成 LaravelSwoole 服务。

核心功能说明
------

[](#核心功能说明)

### 1. 基础服务提供者

[](#1-基础服务提供者)

继承 `SwapCloud\CustomExtend\Extend\SwapCloudServiceProvider` 可自动处理字典加载和权限注册。

示例代码：

```
class DemoServiceProvider extends SwapCloudServiceProvider
{
    // 定义菜单
    protected $menu = [...];
    // 定义字典
    protected $dict = [...];
    // 定义权限
    protected $permission = [...];
}
```

### 2. API 开发支持

[](#2-api-开发支持)

- **路由定义**: 在 `src/Http/api_routes.php` 中定义 API 路由。
- **统一响应**: 使用 `SwapCloud\CustomExtend\Traits\ApiResponseTrait` 实现标准 JSON 返回。

```
use ApiResponseTrait;
return $this->success('操作成功', ['data' => []]);
```

### 3. 公共函数

[](#3-公共函数)

- `admin_user_role_check($role)`: 检查当前管理员是否属于指定角色。

### 4. Swoole 支持

[](#4-swoole-支持)

本扩展集成了 Swoole 相关功能，包括 LaravelSwoole 的配置发布和自定义的协程队列工作进程。

#### 初始化 LaravelSwoole

[](#初始化-laravelswoole)

```
php artisan laravels publish
```

#### 启动 Swoole 队列

[](#启动-swoole-队列)

```
php artisan queue:swoole-work
```

> 更多关于 Swoole 队列的详细配置和高级用法，请参阅 [SwooleWork 文档](docs/swoole-work.md)。

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance57

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/4aa333e293f1a1ac60afd39e0c6f3463404df4d6e2ff11bff698c868826aab18?d=identicon)[itxiao6](/maintainers/itxiao6)

---

Top Contributors

[![itxiao6](https://avatars.githubusercontent.com/u/20547806?v=4)](https://github.com/itxiao6 "itxiao6 (20 commits)")

### Embed Badge

![Health badge](/badges/swap-cloud-custom-extend/health.svg)

```
[![Health](https://phpackages.com/badges/swap-cloud-custom-extend/health.svg)](https://phpackages.com/packages/swap-cloud-custom-extend)
```

PHPackages © 2026

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