PHPackages                             miper/miper - 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. miper/miper

ActiveLibrary[Framework](/categories/framework)

miper/miper
===========

Micro Service Pipe Framework with Restful Style

0.3.2(10y ago)217GPLPHPPHP &gt;=5.5.0

Since Jul 7Pushed 10y ago2 watchersCompare

[ Source](https://github.com/miper/miper)[ Packagist](https://packagist.org/packages/miper/miper)[ Docs](https://github.com/miper/miper)[ RSS](/packages/miper-miper/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (1)Versions (7)Used By (0)

Miper
=====

[](#miper)

`Mi`cro Service Pi`pe` Framework with `R`estful Style
-----------------------------------------------------

[](#micro-service-pipe-framework-with-restful-style)

`Restful`风格、基于管道(`Pipe`)技术、使用`PHP`语言的`微服务`专有框架。

借鉴了`Gulp`以及`linux`里边的管道技术的思想，通过对数据流的控制和管理，给微服务的开发带来前所未有的快感和体验。

Miper的核心思想
----------

[](#miper的核心思想)

1. 提供Restful风格的接口
2. 基于流水线的处理流程
3. 将接口作为基础组件自由拼装
4. 实时生成和浏览接口文档

### 入门

[](#入门)

使用`Miper`很容易上手，下面的例子构建了一个简单的接口。

```
define('VENDOR_DIR', $root.'/vendor/');
define('LIBRARY_DIR', $root.'/src/');

require VENDOR_DIR.'/Miper/Autoload.php';
Miper_Autoload::autoload(VENDOR_DIR, LIBRARY_DIR);

$app = Miper_App::getAppInstance();

// 简单请求
$app->
  get([
    '/hello/world',
    function($req){
      return 'Hello,World';
    }
  ])
  ->output()
  ->end();
```

你可能觉得，pipe貌似不存在，其实上面的例子等价于

```
// 简单请求
$app->
  pipe('request', array(
    'get',
    '/hello/world',
    function($req){
      return 'Hello,World';
    })
  )
  ->pipe('output')
  ->end();
```

下面来看一个稍微复杂的例子，这个接口调用另外一个类的函数返回数据并输出结果。

```
require_once '/app/user/UserExport.php';
$app
  // get请求，网址匹配/user/#{uid}时进行后续处理，如访问/user/40
  // 等于 ->pipe('request', ['get', '/user/#{uid}'])
  ->get('/user/#{uid}')
  // 将请求映射到user模块的getUser方法
  // 等于 ->pipe('call', ['UserExport', 'getUser'])
  ->call(['UserExport', 'getUser'])
  // 输出结果
  // 等于 ->pipe('output')
  ->output()
  // 结束该流程
  ->end()
  ;
```

接下来是一个更加复杂的例子，它利用管道将第一个函数调用结果传给第二个接口，最终输出需要的数据。

```
$app
  // get请求，匹配/user/recommens网址
  ->get('/user/recommends')
  // 将请求先映射到user模块的getRecommendUserIds，
  // 并将返回的用户ID数组封装成array('userIds' => array(2,3,22))的形式，供下一个接口使用
  ->call(['UserExport', 'getRecommendUserIds'], 'userIds')
  // 将前一个接口获取的数据作为参数传递给user模块的batchGetUsers函数
  ->call(['UserExport', 'batchGetUsers'],
    // TODO 用数组模板来约束输出数据的格式
    array(
      '@item' => array(
          'uid' => 'user_id',
          'flag' => '@unset'
        )
    )
  )
  // 输出结果
  ->output()
  // 结束此流程
  ->end()
  ;
```

### nginx 配置

[](#nginx-配置)

```
server {
    server_name  localhost;
    listen       18600;
    root         ~/msful/example/public/;

    location / {
      rewrite ^(/.*?)$ /index.php last;
    }

    location /index.php {
      fastcgi_pass   127.0.0.1:9001;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME    $document_root$fastcgi_script_name;
      fastcgi_param  HTTP_HOST          $host;
      include        fastcgi_params;
    }
}
```

### TODO

[](#todo)

- 文档生成功能
- 数据库ORM/基础功能自动化
- 自动化校验
- 接口数据拼装
- 数据流式及简单逻辑处理
- 自动化测试
- markdown/jade/less支持

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity52

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

5

Last Release

3967d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9a34df4dd25b4a8efe5c4a59f25f84737df592207c5d177ece3f7a3f5f0a01de?d=identicon)[comdeng](/maintainers/comdeng)

---

Top Contributors

[![comdeng](https://avatars.githubusercontent.com/u/5013951?v=4)](https://github.com/comdeng "comdeng (10 commits)")

---

Tags

phpframeworkpiperestfulgulpmicro service

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/miper-miper/health.svg)

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

###  Alternatives

[php-curl-class/php-curl-class

PHP Curl Class makes it easy to send HTTP requests and integrate with web APIs.

3.3k9.5M353](/packages/php-curl-class-php-curl-class)[scrawler/router

An Fully Automatic RESTful PHP Router.

552.2k3](/packages/scrawler-router)[patricksavalle/slim-rest-api

Production-grade REST-API App-class for PHP SLIM, in production on https://zaplog.pro (https://api.zaplog.pro/v1)

101.4k](/packages/patricksavalle-slim-rest-api)

PHPackages © 2026

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