hollisho/http-client
http-client
154
Larablocks Analysis
hollisho/http-client works with any PHP project: the latest release (v1.2.2, Apr 9, 2026) doesn't depend on Laravel.
Recommendation checks
PromisingPromising: maintained and up to date, meets 1 of 3 checks; not yet widely used.
- Released in the last 12 months (Apr 9, 2026)
- 2 downloads a month (needs 10,000)
- 0 GitHub stars (needs 100)
State
Maintained- Last stable release: Apr 9, 2026.
- 1 release in the last 12 months.
- First released: Mar 18, 2025.
- Monthly downloads: 2.
- 0 open issues on GitHub.
Data from Packagist and GitHub, checked by Larablocks on Nov 26, 2026.
| Install | |
|---|---|
composer require hollisho/http-client |
|
| Latest Version: | v1.2.2 |
| PHP: | ^7.0 || ^8.0 |
| License: | MIT |
| Last Updated: | Apr 9, 2026 |
| Links: | GitHub · Packagist |
Maintainer: hollisho
Install
$ composer require hollisho/http-client
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
- 执行指定目录所有用例
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml
- 执行指定文件
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --test-suffix RequestTest.php
- 执行 RequestTest 用例
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --filter RequestTest
- 执行 RequestTest::test 用例
$ ./vendor/phpunit/phpunit/phpunit --configuration phpunit.xml --filter RequestTest::test
Basic Use
$httpClient = new BaseClient('https://www.1024plus.com');
$httpClient->pushMiddleware(new AuthRequest());
$httpClient->httpPost('/category/springboot/');
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);
Alternatives to hollisho/http-client
vinelab/http
An http library developed for the laravel framework. aliases itself as HttpClien...
309,532
57
jeffersongoncalves/laravel-github-client
A lightweight GitHub REST API client for Laravel with tri-state repository statu...
2,087
1
Version History
| Version | Released | PHP | License |
|---|---|---|---|
| v1.2.2 | ^7.0 || | MIT | |
| v1.2.1 | ^7.0 || | MIT | |
| v1.2.0 | ^7.0 || | MIT |