PHPackages                             mostanily/diy-api - 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. mostanily/diy-api

ActiveProject[Framework](/categories/framework)

mostanily/diy-api
=================

个人DIY PHP框架

0.1.0(5y ago)03MITPHPPHP &gt;=7.1.0

Since Jul 30Pushed 5y ago1 watchersCompare

[ Source](https://github.com/mostanily/diy-api)[ Packagist](https://packagist.org/packages/mostanily/diy-api)[ RSS](/packages/mostanily-diy-api/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

diyApi
======

[](#diyapi)

个人diy简易api框架

说明
==

[](#说明)

> 思路来自laravel社区文章 [PHP DIY 系列](https://learnku.com/articles/40697) ，做了一些改动。 此包仅供学习使用

目录说明
====

[](#目录说明)

- `app` 应用目录，主要进行逻辑处理
- `config` 配置信息目录，里面存放一些配置信息，包括路由等等
- `library` 核心类
- `public` 入口文件
- `vendor` composer自动加载公共类

配置
==

[](#配置)

> 配置信息全部放在了`config`目录中，以目录扫描（easyswoole中的File类，具体为：`vendor\easyswoole\utility\src\File.php`）方式进行统一处理；

路由
==

[](#路由)

> 支持以下类似路由设置，对于参数写在链接里的路由，还请放在 `dynamic_route`这个数组里；具体的配置文件均在 `config`这个文件夹中。 注：框架里面 `app\Https\Controller`文件夹中的测试Controller可以全部删除

```
    'route' => [
        'test' => 'demo/test' ,
        'test/api' => 'TestApiController@test' ,
        'test/api2' => 'testApi/test' ,
        'test/api3' => 'TestContainerController@test' ,
        'test/redis' => 'TestRedisController@test_redis' ,
        'test/api5' => 'Activity\TestActivityController@test_activity',
        'test/api6' => 'activity/testActivity/test_activity',
    ] ,
    'dynamic_route' => [
        'test/api4/{id}' => 'TestApiController@test_route' ,
        'test/{id}/name' => 'TestApiController@test_route' ,
        'test/{name}/api4/{id}' => 'TestApiController@test_route2' ,
        '{year}/{month}/{day}/api/test' => 'TestApiController@test_route3' ,
    ],

```

支持依赖注入
======

[](#支持依赖注入)

> 依赖注入核心类文件来自 ； 使用例子如下：

```
    namespace App\Https\Controllers\Activity;
    use Library\Https\Controller;
    use Library\Https\Request;

    class TestActivityController extends Controller
    {
        public function test_activity(Request $request)
        {
            $activityId = $request->get('id');
            return $this->response->json('test activity Id:' . $activityId);
        }
    }

```

> 自己做了个简单的redis单例，支持读写分离，如果不需要，可以自己下载redis包 `composer require predis/predis` 。 mysql没有写，需要的话可以自己写或者参考这篇文章 [在Laravel外独立使用Eloquent](https://www.golaravel.com/post/zai-laravelwai-du-li-shi-yong-eloquent/)

###  Health Score

19

—

LowBetter than 9% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity40

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

Unknown

Total

1

Last Release

2164d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/28912632?v=4)[mostanily](/maintainers/mostanily)[@mostanily](https://github.com/mostanily)

---

Top Contributors

[![mostanily](https://avatars.githubusercontent.com/u/28912632?v=4)](https://github.com/mostanily "mostanily (6 commits)")

### Embed Badge

![Health badge](/badges/mostanily-diy-api/health.svg)

```
[![Health](https://phpackages.com/badges/mostanily-diy-api/health.svg)](https://phpackages.com/packages/mostanily-diy-api)
```

###  Alternatives

[laravel/framework

The Laravel Framework.

34.8k543.8M20.0k](/packages/laravel-framework)[symfony/symfony

The Symfony PHP framework

31.4k87.2M2.2k](/packages/symfony-symfony)[cakephp/cakephp

The CakePHP framework

8.9k19.5M1.8k](/packages/cakephp-cakephp)[bref/bref

Bref is a framework to write and deploy serverless PHP applications on AWS Lambda.

3.4k10.6M67](/packages/bref-bref)[tempest/framework

The PHP framework that gets out of your way.

2.2k34.4k15](/packages/tempest-framework)[typo3/cms

TYPO3 CMS is a free open source Content Management Framework initially created by Kasper Skaarhoj and licensed under GNU/GPL.

1.2k1.9M122](/packages/typo3-cms)

PHPackages © 2026

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