alibabacloud/alibabacloud-yjopenapi-php-client


README

YuanJing OpenAPI SDK for PHP

Requirements

PHP 5.5 and later

Installation

Composer

To install the bindings via Composer:

composer require alibabacloud/alibabacloud-yjopenapi-php-client 1.0.20230810

Then run composer install

Manual Installation

Download the files and include autoload.php:

    require_once('/path/to/vendor/autoload.php');

Usage

<?php
require_once(__DIR__ . '/vendor/autoload.php');

$configuration = \Yjopenapi\Client\Api\Configuration::getDefaultConfiguration();
$configuration
    ->setHost(host)
    ->setAccessKey(Your Access Key)
    ->setSecretKey(Your Secret Key);


// {{Api}},{{Method}},{{Param}} is placeholder, take a look at Explain Of Usage Placeholder
$api = new \Yjopenapi\Client\Api\{{Api}}(new \GuzzleHttp\Client(), $configuration);
try {
    // OpenAPI result
    $result = $api->{{Method}}(${{Param}})

    // OpenAPI result with header
    $resultWithHeader = $api->{{Method}}WithHttpInfo(${{Param}})
    $result = $resultWithHeader[0]

    // OpenAPI TraceId
    $traceId = $resultWithHeader[2][\Yjopenapi\Client\Model\ModelInterface::Trace_Id][0]
    // OpenAPI Status Code
    statusCode := $resultWithHeader[2][\Yjopenapi\Client\Model\ModelInterface::Result_Status][0]

} catch (\Yjopenapi\Client\Api\ApiException $e) {
    // handle exception
}

Explain Of Usage Placeholder

License

Apache-2.0

Copyright (c) 2009-present, Alibaba Cloud All rights reserved.