advancedideasmechanics/api-client 问题修复 & 功能扩展

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

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

advancedideasmechanics/api-client

Composer 安装命令:

composer require advancedideasmechanics/api-client

包简介

API Service to work with DotKernel

README 文档

README

An API client primarily to work with DotKernel API. https://github.com/dotkernel/api

CURRENTLY UNSTABLE

Install

Install via composer

Composer

composer install advancedideasmechanics/apiclient

Call package

Initialize

$apiclient = new ApiClient(baseurl, clientId, clientSecret, grantType, scope, userName, userSecret, tokenLocation, tokenFilename, debug, additionalParams);

See if it works, if api call works it will create a tokenFilename in your chosen location. Create location path if not already in place.

Test

$apiclient->getAccessToken();

Send data to API

$apiclient->makeApiRequest($endpoint, $body, $method = "GET", $additionalHeaders = []);

Initialize Details

Below uses some DotKernel defaults. DO NOT use those values in production.

baseurl = http://localhost:8083

clientId = frontend # DotKernel default

clientSecret = frontend # DotKernel default

grantType = password

scope = api # DotKernel default (you can keep this)

userName = test@dotkernel.com # DotKernel default

userSecret = dotkernel # DotKernel default

tokenLocation = /var/www/data/ # keep outside web folder

tokenFilename = token.json # can be any file name you wish.

debug = false # optional will default to false, this for guzzle debugging to log files.

additionParms = [] # Optional Guzzle parameters.

Send / Retrieve to API

endpoint = /someapiendpoint # start from the root of the baseurl

body = [] # Array of information that will be sent to api as json_encoded() can be just [] if using GET

method = GET # defaults to GET but you can use any HTTP VERB you set if the endpoint accepts it.

additionalHeader = [] # Optional for Guzzle

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2024-10-02