catpkt/http-api-gluer

0.1.0 2018-03-26 11:08 UTC

This package is not auto-updated.

Last update: 2024-09-29 05:14:54 UTC


README

Preliminary see: fenzland/data-parser

Usage

composer require catpkt/http-api-gluer

Create instance of Gluer.

use Fenzland\HttpApiGluer\Gluer;
use Fenzland\DataParser\Transformer;
use CatPKT\Encryptor\Encryptor

$gluer= new Gluer(
	'https://url'           // URL of API.
,
	'POST'                  // Method of API.
,
	$request_transformer    // instance of Transformer.
,
	$response_transformer   // instance of Transformer.
,
	'catpkt/encryptor-php'  // content type of request
,
	'catpkt/encryptor-php'  // content type of response (optional if same with content type of request)
,
	$encryptor              // instance of Encryptor
);

// or

$gluer= Gluer::make_(
	'https://url/{path_param}'
,
	'POST'
,
	$request_transformer_meta           // meta array of Transformer.
,
	$response_transformer_meta          // meta array of Transformer.
,
	'catpkt/encryptor-php'
,
	'catpkt/encryptor-php'
,
	'encrypt-key--with-32-byte-length'  // encrypt key (optional, but require if using 'catpkt/encryptor-php')
,
	'AES-256-CBC'                       // encrypt method (optional, 'AES-256-CBC' as default)
);

Call api.

$result= $gluer->call( $data );