PHPackages                             peachpear/pear-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. [API Development](/categories/api)
4. /
5. peachpear/pear-api

ActiveProject[API Development](/categories/api)

peachpear/pear-api
==================

pear for api framework

1.0.4(6y ago)13MPL-2.0PHPPHP &gt;=7.0.0CI failing

Since Dec 21Pushed 5y ago2 watchersCompare

[ Source](https://github.com/peachpear/pear-api)[ Packagist](https://packagist.org/packages/peachpear/pear-api)[ RSS](/packages/peachpear-pear-api/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (3)Versions (5)Used By (0)

pear-api
========

[](#pear-api)

pear让你更畅快地编程。pear-api是以yii2为基础，去除次要服务，重构为只支持api访问服务的框架。 支持PHP、MySQL、Redis、Kafka、RabbitMQ。

### 前提准备

[](#前提准备)

必要服务支持：Mysql、Nginx、php-fpm、Redis、Kafka、RabbitMQ

可选服务支持：Elasticsearch、Kibana、Jenkins

### 使用说明

[](#使用说明)

```
cd /yourProjectParentPath

composer create-project peachpear/pear-api yourProjectName

cd /path/yourProjectName/backend/config

ln -sf dev.php main.php

```

nginx 配置

```
server {
    charset utf-8;
    client_max_body_size 128M;

    listen 80; ## listen for ipv4
    #listen [::]:80 default_server ipv6only=on; ## listen for ipv6

    server_name yourServerName;
    root        /path/yourProjectName/public;
    index       index.php;

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include fastcgi.conf;
        fastcgi_pass   127.0.0.1:9000;
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        try_files $uri =404;
    }

    #error_page 404 /404.html;

    location ~ /\.(ht|svn|git) {
        deny all;
    }
}

```

#### 目录结构

[](#目录结构)

```
├── backend
|   ├── components
|   ├── config
|   ├── controllers
|   └── lib
├── common
│   ├── components
│   ├── config
│   ├── dao
│   ├── exception
│   ├── lib
│   ├── misc
│   ├── models
│   └── service
└── console
    ├── components
    ├── config
    └── controllers

```

#### 编码规范

[](#编码规范)

```
1.PHP所有 关键字 必须 全部小写（常量 true 、false 和 null 也 必须 全部小写）
2.命名model对应的class 必须 以Model结尾
3.命名service对应的class 必须 以Service结尾
4.命名dao对应的class 必须 以Dao结尾
5.数据库查询返回接口 应该 使用model对象/对象列表
6.数据库的key必须是dbname+DB形式，e.g:dbname为test,则key为testDB
7.dao目录存放sql语句或者orm
8.model目录存放对应的数据实例对象
9.service目录存放业务逻辑处理

```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity5

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity59

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

Total

4

Last Release

2235d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/819a98d6510f153619bca993382ab14b56a861bdb371e60339aa9b98b9b20ace?d=identicon)[iBaiYang](/maintainers/iBaiYang)

---

Top Contributors

[![iBaiYang](https://avatars.githubusercontent.com/u/13947594?v=4)](https://github.com/iBaiYang "iBaiYang (1 commits)")

---

Tags

apiPEARpeachpear

### Embed Badge

![Health badge](/badges/peachpear-pear-api/health.svg)

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

###  Alternatives

[dotzero/yii2-amocrm

Расширение для Yii Framework 2 реализующее клиент для работы с API amoCRM

1639.7k](/packages/dotzero-yii2-amocrm)[skeeks/yii2-google-api

Component for work with google api based on google/apiclient

1243.1k1](/packages/skeeks-yii2-google-api)[apexwire/yii2-restclient

Tools to use API as ActiveRecord for Yii2

143.5k](/packages/apexwire-yii2-restclient)

PHPackages © 2026

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