PHPackages                             listen/restapi - 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. listen/restapi

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

listen/restapi
==============

基于guzzlehttp/guzzle 封装的 http 请求服务

3.4.6(7y ago)2153MITPHPPHP &gt;=5.4

Since Aug 27Pushed 7y agoCompare

[ Source](https://github.com/listen-rain/restapi)[ Packagist](https://packagist.org/packages/listen/restapi)[ RSS](/packages/listen-restapi/feed)WikiDiscussions master Synced 3d ago

READMEChangelogDependencies (4)Versions (17)Used By (0)

Restapi For Laravel5
--------------------

[](#restapi-for-laravel5)

> 🚀`Laravel Restapi` is a package for http request, base from guzzle/http

[![Latest Stable Version](https://camo.githubusercontent.com/d01b2a06968581ad9b1a748f4a4407fc7482f1e00ed62c2f0ff41fb06d90f5e7/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f762f737461626c65)](https://packagist.org/packages/listen/restapi)[![Total Downloads](https://camo.githubusercontent.com/841c156d9564a0f1c41ce2f921373dc7cb147f079b5692f39512033594ab02e9/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f646f776e6c6f616473)](https://packagist.org/packages/listen/restapi)[![Latest Unstable Version](https://camo.githubusercontent.com/000fa17dcc011aab1cf5b58def53eba97353a33cfe62dc7eb12a0b5887a48ddc/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f762f756e737461626c65)](https://packagist.org/packages/listen/restapi)[![License](https://camo.githubusercontent.com/8fd5e117cfaf9a9edaf44ff261860200ffc281ff1245955975f866ed4036b2b5/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f6c6963656e7365)](https://github.com/listen-rain/restapi/blob/master/LICENSE)[![Monthly Downloads](https://camo.githubusercontent.com/a71718c43297164dc1890a56eab9836bbdcd830dc13434f590121aa24f74e9f0/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f642f6d6f6e74686c79)](https://packagist.org/packages/listen/restapi)[![Daily Downloads](https://camo.githubusercontent.com/c9c643cedce0018c8710c94c4a253fe8c687c5a00822610d62e95adbd159813f/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f642f6461696c79)](https://packagist.org/packages/listen/restapi)[![composer.lock](https://camo.githubusercontent.com/9102094f02545f660b45a5ae48ca6d48f718bb840f8a0d35fc38176cf74f991b/68747470733a2f2f706f7365722e707567782e6f72672f6c697374656e2f726573746170692f636f6d706f7365726c6f636b)](https://packagist.org/packages/listen/restapi)

How To Usage
------------

[](#how-to-usage)

install use the composer

```
composer require listen/restapi

```

update config/app.php

```
'providers' => [
    ......
    Listen\Restapi\RestapiServiceProvider::class,
],

'aliases' => [
    ......
    'Restapi'      => Listen\Restapi\Facades\Restapi::class,
],

```

publish config

```
php artisan vendor:publish --provider='Listen\Restapi\RestapiServiceProvider'

# The config file restapi.php while in config drictory
```

configure

```
return [
    'request_timeout' => 5,

    'connect_timeout' => 5,

    'secret'          => '',

    'concurrency'     => 5,

    'log_file'        => storage_path('logs/restapi.log'),

    'log_channel'     => 'restapi',

    'log_mode'        => 'single',

    '' => [
        'secret'   => env('RESTAPI__KEY', ''),
        'base_uri' => env('RESTAPI__URL', 'http://local.application.com'),
    ],
];
```

single request example

```
# GET
Restapi::get($moduleName, $uri, $params, $headers);

# POST
Restapi::post($moduleName, $uri, $params, $headers);

# GETASYNC
Restapi::getAsync($moduleName, $uri, ['name' => 'listen'], function ($response, $module, $params, $uri) {
    dd($response);
}, function ($e, $module, $params, $uri) {
    dd($e->getMessage());
});

# POSTASYNC
Restapi::postAsync($moduleName, $uri, ['name' => 'listen'], function ($response, $module, $params, $uri) {
    dd($response);
}, function ($e, $module, $params, $uri) {
    dd($e->getMessage());
});

```

multi request example

```
# An interface is requested multiple times
$params = [
    [
        'user_id' => 1,
        'user_name' => 'new name'
    ],
    [
        'user_id' => 2,
        'user_name' => 'new name2'
    ]
];

$responses = \Restapi::multiRequest('post', 'http://test.local/user', $params, ['Content-Type' => 'application/x-www-form-urlencoded']);
dd($responses);

# Multiple interfaces are requested concurrently
$apis = [
    [
        'module' => 'user',
        'method' => 'postAsync',
        'params' => ['key' => 'value'],
        'uri'    => 'http://test.local/user'
    ],
    [
        'module' => 'book',
        'method' => 'postAsync',
        'params' => ['key' => 'value'],
        'uri'    => 'http://test.local/book'
    ],
];
$result = \Restapi::multiModuleRequest($apis);
dd($result);
```

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity65

Established project with proven stability

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

Recently: every ~1 days

Total

16

Last Release

2598d ago

Major Versions

1.0 → 2.02018-09-11

2.1 → 3.02019-01-04

2.1.2 → 3.3.12019-03-07

### Community

Maintainers

![](https://www.gravatar.com/avatar/8a57f985c4d59480c0f310f92e51fd2bbc5a211b6a5f8a9f011720d0800ee854?d=identicon)[listen-rain](/maintainers/listen-rain)

---

Top Contributors

[![listen-rain](https://avatars.githubusercontent.com/u/41713191?v=4)](https://github.com/listen-rain "listen-rain (11 commits)")

### Embed Badge

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

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

###  Alternatives

[illuminate/http

The Illuminate Http package.

11936.0M5.1k](/packages/illuminate-http)[omniphx/forrest

A Laravel library for Salesforce

2724.4M8](/packages/omniphx-forrest)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)

PHPackages © 2026

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