承接 mohamedahmed01/laravel-http-query-polyfill 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

mohamedahmed01/laravel-http-query-polyfill

Composer 安装命令:

composer require mohamedahmed01/laravel-http-query-polyfill

包简介

Backward-compatible polyfill for Laravel's Http::query() method (RFC 10008) on Laravel < 13.19

README 文档

README

Backward-compatible polyfill for Http::query() introduced in Laravel 13.19.0 (RFC 10008).

On Laravel < 13.19, this package registers PendingRequest::query() so you can send HTTP QUERY requests with a body. On Laravel 13.19+, registration is skipped and the native method is used unchanged.

Installation

composer require mohamedahmed01/laravel-http-query-polyfill

The service provider is auto-discovered. No further setup is required.

Usage

Same API as Laravel 13.19+:

use Illuminate\Support\Facades\Http;

$response = Http::query('https://api.example.com/search', [
    'filter' => ['status' => 'active'],
]);

JSON is the default body format. Use existing fluent helpers for other formats:

Http::asForm()->query('https://api.example.com/search', [
    'filter' => 'active',
]);

URL query strings are unchanged — keep using withQueryParameters() or Http::get($url, $query) for those.

Testing helpers (Laravel < 13.19)

Laravel 13.19 also added $this->query() / $this->queryJson() on HTTP tests. Those live on a trait, so they cannot be auto-registered. On older Laravel, add the polyfill trait to your base test case:

use Illuminate\Foundation\Testing\TestCase as BaseTestCase;
use MohamedAhmed01\HttpQueryPolyfill\Testing\MakesHttpQueryRequests;

abstract class TestCase extends BaseTestCase
{
    use MakesHttpQueryRequests;
}

Then:

$this->queryJson('/search', ['filter' => 'active'])->assertOk();

Do not use this trait on Laravel 13.19+ — the methods already exist and will collide.

Compatibility

Laravel Behavior
10.x – 13.18 Macro polyfill registered
13.19+ No-op; native Http::query() used

License

MIT

统计信息

  • 总下载量: 0
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-07-12

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固