定制 pickmap/service-request 二次开发

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

邮箱: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
  • 点击次数: 2
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固