PHP code example of commercesignals / csapi-php

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

    

commercesignals / csapi-php example snippets


const CERT_FILE_NAME = 'my-api-key-private-cert.pem';
const API_KEY = '0b70012a-5a7a-2b90-815a-aa73a7f8001a'; // My API Key
const API_BASE = 'https://api.commercesignals.com/';

$api = new CommerceSignals\API(API_BASE, [
  'apiKey' => API_KEY,
  'cert' => file_get_contents(__DIR__ . '/' . CERT_FILE_NAME)
]);

  $api->signals('0a000337-574f-223e-8156-4f3a98e707a1')
    ->requests('0a00017c-5aac-1195-82ba-ae6ea3fa000a')
    ->results()
    ->get();

get() => GET request
update() => PATCH request
save() => POST or PUT (depending on if the payload BODY has an id set or not)