定制 rnr1721/le7-http-client 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

rnr1721/le7-http-client

最新稳定版本:1.0.1

Composer 安装命令:

composer require rnr1721/le7-http-client

包简介

PSR Http-client for le7 PHP MVC framework or any PSR project

README 文档

README

Http client client for le7 PHP MVC framework or any PSR project This is an simple PSR http-client implementation

API Request Utility

This project provides HTTP clients that uses Curl and standard PHP functions to make requests.

What it can?

  • Create HTTP requests using cURL
  • Create HTTP requests using standard PHP tools

Requirements

  • PHP 8.0 or higher
  • Composer (for installing dependencies)

Installation

  1. Install via composer:
composer require rnr1721/le7-http-client

Testing

composer test

Usage

In this example, I use Nyholm PSR library, but you can use any, Guzzle for example

Get ClientInterface object (httpClient)

use Nyholm\Psr7\Factory\Psr17Factory;
use Core\HttpClient\HttpClientCurl;
use Core\HttpClient\HttpClientDefault;

// Create PSR factories. Nyholm realisation is a single factory to all
$psr17Factory = new Psr17Factory();

// Get Curl http client
$httpClientCurl = new HttpClientCurl(
    $psr17Factory // ResponseFactoryInterface
)

// Or if need get PHP http client
$httpClientPhp = new HttpClientDefault(
    $psr17Factory // ResponseFactoryInterface
)

// now we can use it:

$request = $psr17Factory->createRequest('GET', 'http://tnyholm.se');

$response = $httpClientCurl->sendRequest($request);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-05-22

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固