PHP code example of freyo / qcloud-apigateway-http

1. Go to this page and download the library: Download freyo/qcloud-apigateway-http library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

freyo / qcloud-apigateway-http example snippets




reyo\ApiGateway\Application;

$app = new Application([
    'response_type' => 'array',
    'secret_key'    => 'your-secret-key',
    'secret_id'     => 'your-secret-id',
    'region'        => 'your-gateway-region', // e.g., ap-guangzhou
    'log'           => [
        'file'  => __DIR__ . DIRECTORY_SEPARATOR . 'apigateway.log',
        'level' => 'debug',
    ],
    'http' => [
        'base_uri' => 'http://{service-id}.{region}.apigw.tencentcs.com',
        // 'base_uri' => 'http://{service-id}.{region}.apigateway.myqcloud.com',
    ],
]);

$response = $app->base_client->httpGet('path/to');

var_dump($response);