PHPackages                             rexwsd/laravel-http - 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. rexwsd/laravel-http

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

rexwsd/laravel-http
===================

Laravel框架和GuzzleHttp二次封装基于驱动管理的http服务

101PHP

Since Dec 20Pushed 4y ago1 watchersCompare

[ Source](https://github.com/rexwsd/laravel-http)[ Packagist](https://packagist.org/packages/rexwsd/laravel-http)[ RSS](/packages/rexwsd-laravel-http/feed)WikiDiscussions main Synced 2w ago

READMEChangelogDependenciesVersions (1)Used By (0)

驱动化管理HTTP服务Libray
=================

[](#驱动化管理http服务libray)

Install
-------

[](#install)

### 方式一

[](#方式一)

> composer require rexwsd/laravel-http

### 方式二

[](#方式二)

Step1: 在项目composer.json文件require段中增加如下：

```
"require": {
         "rexwsd/laravel-http": "*"
     }
```

Step2: 执行

> composer update rexwsd/laravel-http

Document
--------

[](#document)

### config配置

[](#config配置)

> 拷贝包内config/http.php 到项目下 config/http.php

#### 自定义驱动

[](#自定义驱动)

```
'gao_de' => [
        'gateway_url' => 'http://restapi.amap.com',
        'debug' => 'false',
        'timeout' => 1, // 全局超时时长
        'retry' => 1, // 全局重试次数
        'sleep' => 0, // 睡眠时间,只有开启重试后会启用
    ]
```

---

### http管理类

[](#http管理类)

> 在 App\\Components\\Http 创建 HttpManager 类 (路径不存在自行创建)

```
class HttpManager extends \Laravel\Http\HttpManager
{
    public function createGaoDeDriver()
    {
        return new GaoDeRequest($this->app, $this->getConfig('gao_de'));
    }
}
```

> 在 App\\Components\\Http\\Requests 创建自定义响应类 GaoDeRequest 继承 Laravel\\Http\\Request\\SiheRequest

```
class GaoDeRequest extends BaseRequest
{
    //这里面你可以重写一些父类的方法: 例如 get  post send 等 根据你自己的业务需求 当然你也可以不写直接食用
}
```

### Provider 注册

[](#provider-注册)

> 在 App\\Providers 的 AppServiceProvider 类里注册

```
use App\Components\Http\HttpManager;

public function register()
    {
        $this->app->singleton('http', function () {
            return new HttpManager($this->app);
        });

    }
```

> 这样我们就把我们自定义的HttpManager覆盖注册到服务容器里了, 我这个是注册了一个调用高德api的接口例子

### 食用范例

[](#食用范例)

```
use Laravel\Http\Facades\Http;

$parameters = [
            'output' => 'json',
            'location' => "116.543302,39.923348" //公司坐标
        ];
        $res = Http::with('gao_de') //通过哪个驱动发起http请求
            ->timeout(1)  //请求超时时间 单位秒
            ->retry(1) //请求超时重试次数
            ->get('/v3/geocode/regeo', $parameters)->toArray(); //发起一个get请求

        dd($res);//打印请求结果
```

###  Health Score

16

—

LowBetter than 4% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity28

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15683150?v=4)[David Rex](/maintainers/rexwsd)[@rexwsd](https://github.com/rexwsd)

---

Top Contributors

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

### Embed Badge

![Health badge](/badges/rexwsd-laravel-http/health.svg)

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

###  Alternatives

[php-http/cache-plugin

PSR-6 Cache plugin for HTTPlug

25025.5M80](/packages/php-http-cache-plugin)[illuminate/http

The Illuminate Http package.

11937.2M6.5k](/packages/illuminate-http)[rdkafka/rdkafka

A PHP extension for Kafka

2.2k20.0k1](/packages/rdkafka-rdkafka)[httpsoft/http-message

Strict and fast implementation of PSR-7 and PSR-17

87930.4k113](/packages/httpsoft-http-message)[mezzio/mezzio-router

Router subcomponent for Mezzio

265.3M84](/packages/mezzio-mezzio-router)[serpapi/google-search-results-php

Get Google, Bing, Baidu, Ebay, Yahoo, Yandex, Home depot, Naver, Apple, Duckduckgo, Youtube search results via SerpApi.com

69122.6k](/packages/serpapi-google-search-results-php)

PHPackages © 2026

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