pickmap/service-request 问题修复 & 功能扩展

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

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

pickmap/service-request

最新稳定版本:0.2.0

Composer 安装命令:

composer require pickmap/service-request

包简介

A regular structure for sending requests from client to client

README 文档

README

If you work in a macro service structure or if you need a very light library to send and receive reposts in a simple service or application, this library will greatly help you.

Currently, it is only implemented to receive tokens from https://www.keycloak.org/, but you can complete it ‍‍‍‍ The best usage example is shown in this chart so that you can do the "Request To Service With Token" step with this library.

enter image description here

setp #1

composer require pickmap/service-request

setp #2

Define the following variables in your .env file

KEYCLOAK_CLIENT_ID=client-id
KEYCLOAK_CLIENT_SECRET=keycloak-secret-key
KEYCLOAK_USERNAME=usernameOrEmail
KEYCLOAK_PASSWORD=password
KEYCLOAK_LOGIN_URL='https://...openid-connect/token?grant_type=password'

setp #2

In any class you want to be equipped to send a request like a model or controller, do the following

class  sample {
use  ServiceRequest;

public  function  aMethod()
	{
		self::requestPost('https:://service.com/list');
	}
}

You can access these methods separately

//If $refreshToken is equal to true, the token will be refreshed regardless of the cache
self::getToken($refreshToken);

self::requestToKeyCloak();

/*
Authorization is set in all tokens, but with this method, it is overwritten by the third parameter of post and get methods.
*/
self::HeadersProcess($newHeader);

self::requestPost(string  $url,array  $data  = [],$headers  = []);

self::requestGet(string  $url,array  $data  = [],$headers  = []);

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2023-09-03