PHP code example of klimapi / php

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

    

klimapi / php example snippets


$klimapi = new KlimAPI\Api\KlimApi('your-private-api-key');

$pendingByCarbonRequest = new \KlimAPI\Model\PendingByCarbonRequest([
    'kgCO2e' => 200
]);

$order = $klimapi->pendingByCarbon($pendingByCarbonRequest);

$processOrder = new \KlimAPI\Model\ProcessOrder([
    'recipientName' => 'Test Customer'
]);
$orderId = 'CA-0000-00000000';

$processed_order = $klimapi->process($processOrder, $orderId);