定制 realconnex/http-request 二次开发

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

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

realconnex/http-request

Composer 安装命令:

composer require realconnex/http-request

包简介

Realconnex request library.

README 文档

README

Common library to make request

Installation

$ composer require realconnex/http-request

Configuration

Register class as a service in service.yml

parameters:
    # flag indicates verification of hosts certificates
    verifyHost: '%env(bool:VERIFY_HOST)%'
    # web services names configuration
    webServices:
        green: '%env(string:SERVICE_DOMAIN_GREEN)%'
        blue: '%env(string:SERVICE_DOMAIN_BLUE)%'
        mc: '%env(string:SERVICE_DOMAIN_MC)%'
        feed: '%env(string:SERVICE_DOMAIN_FEED)%'
        mbau: '%env(string:SERVICE_DOMAIN_MBA)%'
        search: '%env(string:SERVICE_DOMAIN_SEARCH)%'
        email: '%env(string:SERVICE_DOMAIN_EMAIL)%'
        fapi: '%env(string:SERVICE_DOMAIN_FAPI)%'
        file: '%env(string:SERVICE_DOMAIN_FILE)%'
services:
    Realconnex\HttpRequest:
        arguments:
            $webServices: '%webServices%'
            $verifyHost: '%verifyHost%'
        public: true

Usage

Inject package into you class

public function __construct(HttpRequest $httpRequest)
{
    $this->httpRequest = $httpRequest;
}

Send request

$response = $this->httpRequest->sendRequest(
    HttpServices::MC, // service you want to reach
    'api/v1/notifications', // uri
    HttpRequest::METHOD_POST, // method
    $payload // payload
);

Options

  • verifyHost – flag allows to set Guzzle client “verify” option for SSL-certificates verification.
  • webServices – specifies a list of web services in format “name:domain” which this service can work with.
  • processExceptions – flag indicates if exceptions should be processed automatically.
  • parseJson – flag specifies that response should be automatically parsed as JSON.
  • authToken – JWT token string for header Authorization.
  • provideAuth – flag allows to specify should service use Authorization header or not (could be used in chain of microservices).

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-10-09

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固