PHP code example of javareact / cq-api

1. Go to this page and download the library: Download javareact/cq-api 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/ */

    

javareact / cq-api example snippets


use GuzzleHttp\Client;
use JavaReact\CQApi\CQBalance;

$goods = new CQBalance("appKey", "secret", function() {
    return new Client([
        "base_uri" => \JavaReact\CQApi\Client::DEFAULT_GATEWAY,//可省略
    ]);
});

$response = $balance->balanceGet("productid");
if($response->getStatusCode() == 200) {
    $json = $response->json();
    $result = $response->result();
}