PHPackages                             pifeifei/easy-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. pifeifei/easy-api

ActiveLibrary[API Development](/categories/api)

pifeifei/easy-api
=================

easy api client.

v0.1.8(1y ago)059Apache-2.0PHPPHP ^7.4|^8.0CI passing

Since Nov 14Pushed 1y ago1 watchersCompare

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

READMEChangelogDependencies (12)Versions (10)Used By (0)

easy api client
===============

[](#easy-api-client)

一个容易上手的 api 客户端工具

Requirement
-----------

[](#requirement)

1. PHP &gt;= 7.4
2. Composer
3. openssl 拓展（建议）
4. fileinfo 拓展（建议）

Installation
------------

[](#installation)

```
composer require "pifeifei/easy-api"
```

Usage
-----

[](#usage)

```
$config = [
    'config' => [
        'app_key' => 'app key string',
        'app_secret' => 'app secret string'
    ],
    'request' => [
        "uri" => 'https://httpbin.org/anything',
        "sandbox_uri" => 'https://httpbin.org/anything/sandbox',
        "method" => Pff\EasyApi\API::METHOD_JSON, // 默认请求方式，可选：GET, POST, JSON
        "sign" => [
            "position" => Pff\EasyApi\API::SIGN_POSITION_HEAD,
            "key" => "sign",
            "appends" => [
                "sign_type" => 'MD5'
            ],
        ],
        "signature" => Pff\EasyApi\Signature\MD5Signature::class, // 继承 \Pff\EasyApi\Signature\SignatureInterface::class
        "formatter" => Pff\EasyApi\Format\HttpBinFormatter::class,
        "cache" => Pff\EasyApi\Cache\Cache::class, // auth 获取 access_token 等数据后，保存数据时会用到
        "format" => Pff\EasyApi\API::RESPONSE_FORMAT_JSON, // 响应信息格式化
    ]
];

$client = new Client($config);
$response = $client->request();
// get
$response = $client->method(Pff\EasyApi\API::METHOD_GET)
    ->path("any/path/to")
    ->setData(['a'=>'foo', 'b'=>'bar'])
    ->request();
// json post
$response = $client->path("any/path/to")
    ->setData(['a'=>'foo', 'b'=>'bar'])
    ->request();
```

> 把上面代码封装一下会更好用，可以参考 tests/Feature/Clients/WechatClient

test
----

[](#test)

```
phpunit
# phpunit --list-groups

# 微信开放平台测试
#php -S 0.0.0.0:8080 -t ./tests/stubs/wechat
#phpunit --group wechat
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance44

Moderate activity, may be stable

Popularity8

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity51

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

Recently: every ~226 days

Total

9

Last Release

442d ago

PHP version history (3 changes)v0.1PHP ^5.6|^7.0

v0.1.1PHP ^7.1|^8.0

v0.1.3PHP ^7.4|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/fc216c7ee84b2ff2d6ce691374f620197be0247e723f043ef01007c92954c06f?d=identicon)[pifeifei](/maintainers/pifeifei)

---

Top Contributors

[![pifeifei](https://avatars.githubusercontent.com/u/45787170?v=4)](https://github.com/pifeifei "pifeifei (19 commits)")

---

Tags

apiclienteasy

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/pifeifei-easy-api/health.svg)

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

###  Alternatives

[resend/resend-php

Resend PHP library.

564.7M21](/packages/resend-resend-php)[optiosteam/payconiq-client-php

Payconiq API client library for PHP developed by Optios.

1273.4k](/packages/optiosteam-payconiq-client-php)[ardakilic/mutlucell

Mutlucell SMS API wrapper for sending sms text messages for Laravel

457.3k](/packages/ardakilic-mutlucell)

PHPackages © 2026

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