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 5d 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 10% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity39

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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

2117d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a0040445d7a4838104e6258ed09e4856575c1687ce0666f1cd8c192f5838aa6?d=identicon)[mostanily](/maintainers/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

[cakephp/cakephp

The CakePHP framework

8.8k18.5M1.6k](/packages/cakephp-cakephp)[silverstripe/framework

The SilverStripe framework

7213.5M2.5k](/packages/silverstripe-framework)[drupal/core-recommended

Locked core dependencies; require this project INSTEAD OF drupal/core.

6939.5M343](/packages/drupal-core-recommended)[cakephp/core

CakePHP Framework Core classes

6026.8M39](/packages/cakephp-core)[contao/core-bundle

Contao Open Source CMS

1231.6M2.4k](/packages/contao-core-bundle)[neos/flow

Flow Application Framework

862.0M451](/packages/neos-flow)

PHPackages © 2026

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