tereta/curl 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

tereta/curl

Composer 安装命令:

composer require tereta/curl

包简介

Tereta/Curl is a facade over cURL. For everyday tasks there is a simple facade with `get()` and `post()` methods, and for several requests at once — parallel execution powered by `curl_multi`.

README 文档

README

🌐 English | Русский | Українська

Contents

Introduction

Tereta/Curl is a facade over cURL. For everyday tasks there is a simple facade with get() and post() methods, and for several requests at once — parallel execution powered by curl_multi.

Requirements

  • PHP 8.2 or newer.
  • The ext-curl extension.

Installation

composer require tereta/curl

Repository: https://gitlab.com/tereta/library/curl

Usage

The entry point is the Tereta\Curl\Client facade.

Available methods:

  • get(string $url, array $params = []) — a GET request. $params are appended to the query string. Returns the response body (string).
  • post(string $url, mixed $params = null) — a POST request. $params are sent in the request body. Returns the response body (string).
  • create() — return a client for several requests that are executed in parallel.

If the response code is anything other than 200, get() and post() throw Tereta\Curl\Exceptions\Error.

Examples

Simple requests:

use Tereta\Curl\Client;

$client = new Client();

// GET with parameters (?page=2)
$html = $client->get('https://example.com', ['page' => 2]);

// POST with a request body
$response = $client->post('https://example.com/api', ['name' => 'Alex']);

Parallel requests via create():

$service = (new Client())->create();

$first  = $service->request('https://example.com/one');
$second = $service->request('https://example.com/two');

// both requests run at the same time
$service->execute();

$bodyOne = $first->getResponse()->getBody();
$bodyTwo = $second->getResponse()->getBody();

统计信息

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

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固