PHPackages                             aronwu/restful - 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. [HTTP &amp; Networking](/categories/http)
4. /
5. aronwu/restful

ActiveLibrary[HTTP &amp; Networking](/categories/http)

aronwu/restful
==============

A lightweight PHP Restful Client library

0.1.0(9y ago)17MITPHPPHP &gt;=5.3

Since Jul 30Pushed 9y ago1 watchersCompare

[ Source](https://github.com/aronwu/restful)[ Packagist](https://packagist.org/packages/aronwu/restful)[ Docs](https://github.com/aronwu/Restful)[ RSS](/packages/aronwu-restful/feed)WikiDiscussions master Synced 4w ago

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

Restful Client
==============

[](#restful-client)

RestfulClient是最轻量的Restful PHP 客户端库

如何导入
====

[](#如何导入)

```
include '../src/Restful/Client.php';
include '../src/Restful/Exception.php';

class_alias('\Restful\Client', '\RestfulClient');

```

composer
========

[](#composer)

```
{
    "require": {
       "aronwu/restful": "*"
    }
}

```

配置HostAlias
===========

[](#配置hostalias)

```
$hostalias = [
    'order' => 'https://orderapi.xxx.com/v1',
    'product' => 'https://productapi.xxx.com/v1',
];

//设置HostAlias
\RestfulClient::hostalias($hostalias);

//可以随时切换到不同的api
//访问order
\RestfulClient::host('order')->...
//访问商品
\RestfulClient::host('proudct')->...

```

如何设置Http Basic Authorization
============================

[](#如何设置http-basic-authorization)

```
\RestfulClient::auth('username', 'token');

```

Restful动作
=========

[](#restful动作)

支持 GET， POST， PUT， DELETE，PATCH 五个http mothod

Restful请求路径
===========

[](#restful请求路径)

比如 GET /orders/{order\_id}/weixinpay

```
\RestfulClient::host('order')->orders('{order_id}')->weixinpay()->get(
 [
   'order_id' => 123456,
   'limit' => 0

 ]
);

```

每个//之间资源都可以作为方法名称调用，比如/orders/ 可以调用方法orders， 方法参数也作为访问的路径自动添加。

手动设置Restful请求路径
===============

[](#手动设置restful请求路径)

```
\RestfulClient::host('order')->path('/orders/{order_id}/weixinpay')->get(
 [
   'order_id' => 123456,
   'limit' => 0

 ]
);

```

调用path方法手动设置请求路径。

设置POST、PUT请求数据格式
================

[](#设置postput请求数据格式)

设置x-www-form-urlencoded和 json格式调用format方法，默认是json格式。

```
\RestfulClient::host('order')->orders()->format->('urlencode')->post(
 [
   'product_id' => 123456,
   'order_count' => 2

 ]
);

```

###  Health Score

22

—

LowBetter than 21% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

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

3623d ago

### Community

Maintainers

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

---

Top Contributors

[![wuswoo2008](https://avatars.githubusercontent.com/u/230835299?v=4)](https://github.com/wuswoo2008 "wuswoo2008 (5 commits)")

---

Tags

httpapirestcurlrestfulrequests

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[nategood/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

1.8k17.5M274](/packages/nategood-httpful)[voku/httpful

A Readable, Chainable, REST friendly, PHP HTTP Client

16185.0k1](/packages/voku-httpful)[ismaeltoe/osms

PHP library wrapper of the Orange SMS API.

4540.5k](/packages/ismaeltoe-osms)[msankhala/parsehub-php

Php wrapper classes for Parsehub REST api.

1312.4k](/packages/msankhala-parsehub-php)[wellrested/wellrested

Simple PHP Library for RESTful APIs

4819.2k4](/packages/wellrested-wellrested)

PHPackages © 2026

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