PHPackages                             hollisho/http-client - 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. hollisho/http-client

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

hollisho/http-client
====================

http-client

v1.2.1(10mo ago)0119MITPHPPHP ^7.0 || ^8.0

Since Mar 18Pushed 10mo ago1 watchersCompare

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

READMEChangelog (2)Dependencies (4)Versions (3)Used By (0)

Install
-------

[](#install)

```
$ composer require hollisho/http-client
```

AnnotationRegistry
------------------

[](#annotationregistry)

```
if (file_exists(dirname(__FILE__) . '/vendor/autoload.php')) {
    require_once dirname(__FILE__) . '/vendor/autoload.php';
}

// 注册 Doctrine 注解，为 PHP 8.0 做特殊处理
if (PHP_VERSION_ID >= 80000) {
    // PHP 8.0+ 需要明确注册注解命名空间
    if (class_exists('Doctrine\Common\Annotations\AnnotationRegistry')) {
        // 注册类加载器
        AnnotationRegistry::registerLoader('class_exists');

        // 显式注册 hollisho 的注解命名空间
        if (method_exists(AnnotationRegistry::class, 'registerAutoloadNamespace')) {
            AnnotationRegistry::registerAutoloadNamespace(
                'hollisho\httpclient\Annotations',
                dirname(__FILE__) . '/vendor/hollisho/http-client/src/Annotations'
            );
        }
    }
} else {
    // PHP 7.x
    if (method_exists(AnnotationRegistry::class, 'registerLoader')) {
        AnnotationRegistry::registerLoader('class_exists');
    }
}
```

TestCase
--------

[](#testcase)

1. 执行指定目录所有用例

```
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml
```

2. 执行指定文件

```
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --test-suffix RequestTest.php
```

3. 执行 RequestTest 用例

```
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --filter RequestTest
```

4. 执行 RequestTest::test 用例

```
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --filter RequestTest::test
```

Basic Use
---------

[](#basic-use)

```
$httpClient = new BaseClient('https://www.1024plus.com');
$httpClient->pushMiddleware(new AuthRequest());
$httpClient->httpPost('/category/springboot/');
```

Use Annotation
--------------

[](#use-annotation)

```
/**
 * @author Hollis
 * Interface UserService
 *
 * @BaseUrl(host="https://www.1024plus.com/")
 *
 * @package hollisho\httpclientTests\Service
 */
interface UserService
{
    /**
     * @Headers(headers={
     *     @AuthBasic(username="override", password="override"),
     *     @CustomHeader(name="x-override", body="test")
     * })
     *
     * @Action(
     *     method=@Get,
     *     endpoint=@Endpoint(uri="/api/entry/{id}")
     * )
     */
    public function getUser($id);

    /**
     * @Action(
     *     method=@Post,
     *     endpoint=@Endpoint(uri="/resource"),
     *     body=@Body(json=true, name="body")
     * )
     */
    public function createUser($body);
}

// 生成 FeignClient 实例
$client = FeignClientFactory::create(UserService::class);
echo $client->getUser(1);
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance54

Moderate activity, may be stable

Popularity12

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity43

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

Total

2

Last Release

315d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4e8e63d951619620f1fabe34874623212834045e7ce9b77da8e47769c6e3d7a4?d=identicon)[hollisho](/maintainers/hollisho)

---

Top Contributors

[![hollisho](https://avatars.githubusercontent.com/u/13307208?v=4)](https://github.com/hollisho "hollisho (43 commits)")

---

Tags

httpclientlaravellumen

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Type Coverage Yes

### Embed Badge

![Health badge](/badges/hollisho-http-client/health.svg)

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

###  Alternatives

[vinelab/http

An http library developed for the laravel framework. aliases itself as HttpClient

59300.2k11](/packages/vinelab-http)[rap2hpoutre/jacky

Opinionated REST JSON HTTP API client for laravel

174.4k](/packages/rap2hpoutre-jacky)[cybercog/youtrack-rest-php

YouTrack REST API PHP Client.

37149.2k3](/packages/cybercog-youtrack-rest-php)[laragear/api-manager

Manage multiple REST servers to make requests in few lines and fluently.

161.8k](/packages/laragear-api-manager)[meteocontrol/vcom-api-client

HTTP Client for meteocontrol's VCOM API - The VCOM API enables you to directly access your data on the meteocontrol platform.

175.7k1](/packages/meteocontrol-vcom-api-client)

PHPackages © 2026

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