PHP code example of laxinplus / openapi-php-sdk

1. Go to this page and download the library: Download laxinplus/openapi-php-sdk 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/ */

    

laxinplus / openapi-php-sdk example snippets


  


\GuzzleHttp\Client;

$host = "host"; // 蓝信开放平台网关地址, e.g.: https://example.com/open/apigw
$appId = "appId"; // 应用ID, e.g.: 1234567-7654321
$appSecret = "appSecret"; // 应用密钥, e.g.: D25F65E65D887AEFD9C92B00310286FA

$config = new LanXinPlusOpenAPI\Configuration($host, $appId, $appSecret);
$api = new LanXinPlusOpenAPI\Api\AuthApi(new Client(), $config);
$resp = $api->V1ApptokenCreate("client_credential" ,$appId, $appSecret);
print_r($resp);

  composer 

  "    "laxinplus/openapi-php-sdk": "~1.0"
  }

  
bash
composer install
./vendor/bin/phpunit test/api/AuthApiTest.php