定制 exewen/http 二次开发

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

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

exewen/http

最新稳定版本:v2.1.0

Composer 安装命令:

composer require exewen/http

包简介

A http component for Exewen.

README 文档

README

composer require exewen/http

复制配置

cp -rf ./publish/exewen /your_project/config

初始化

!defined('BASE_PATH_PKG') && define('BASE_PATH_PKG', dirname(__DIR__, 1));

请求

# 初始化 DI
$app      = ApplicationContext::getContainer();
$app->setProviders([LoggerProvider::class,LoggerProvider::class]);
$this->app = $app;
/** @var HttpClientInterface $http */
$http = $this->app->get(HttpClientInterface::class);

# get
$response = $http->get('nacos', '/nacos/v1/cs/configs', [
    'dataId' => $this->dataId,
    'group' => $this->group,
    'tenant' => $this->namespaceId,
]);

# post
$response = $http->post('nacos', '/nacos/v1/ns/instance', [
    'namespaceId' => $this->namespaceId,
    'serviceName' => $this->serviceName,
    'groupName' => $this->group,
    'ip' => '10.0.2.143',
    'port' => 8081,
    'metadata' => json_encode([
        'ver' => "1.0.0"
    ], JSON_UNESCAPED_UNICODE),
]);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-01-11