eddycjy / aliyun-api-gateway-sdk
aliyun-api-gateway-sdk
0.9.1
2017-09-28 06:23 UTC
Requires
- php: >=5.4
Requires (Dev)
- phpunit/phpunit: ^5.7
This package is not auto-updated.
Last update: 2025-03-02 06:46:03 UTC
README
Requirements
- PHP >= 5.4.0
- Composer
- Curl
Installation
composer require eddycjy/aliyun-api-gateway-sdk
Configuration
Use File
Copy Env.example.php file to Env.php
return [ 'AccessKeyId' => '', 'AccessKeySecret' => '', 'Format' => 'json', 'Version' => '2016-07-14', 'SignatureMethod' => 'HMAC-SHA1', 'SignatureVersion' => '1.0' ];
Use Array
use ApiGateway\Config\ArrayConfig; use ApiGateway\Model\ApiGroup\CreateApiGroup; use ApiGateway\ApiService; $config = new ArrayConfig([ 'AccessKeyId' => '', 'AccessKeySecret' => '', 'Format' => 'json', 'Version' => '2016-07-14', 'SignatureMethod' => 'HMAC-SHA1', 'SignatureVersion' => '1.0' ]); $model = new CreateApiGroup(); $model->setGroupName('Demo'); $model->setDescription('Demo-CreateApiGroup'); $serviceObj = new ApiService($model, $config); $response = $serviceObj->get();
Usage
Please see the example directory
Gen
Generate Model and Example:
# Python 3.x
python gen.py
Please input class name: CreateApi
Please input class group: Api
Please input class property-key: GroupId
Please input class property-params: id
# input q to quit
Please input class property-key: q
- Model Code:
namespace ApiGateway\Model\Api; use ApiGateway\ApiModel; class CreateApi extends ApiModel { public $GroupId; public function setGroupId($id) { $this->GroupId = $id; return $this; } ...
- Example Code:
use ApiGateway\Model\Api\CreateApi; use ApiGateway\ApiService; $object = new CreateApi(); $object->setGroupId($demo); ... $serviceObj = new ApiService($object); $response = $serviceObj->get();
License
MIT