PHP code example of astrotomic / ecologi-sdk

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

    

astrotomic / ecologi-sdk example snippets


use Astrotomic\Ecologi\Ecologi;
use Astrotomic\Ecologi\Enums\CarbonUnit;

$ecologi = new Ecologi($token);

// Reporting API
$ecologi->reporting()->getTrees('astrotomic');
$ecologi->reporting()->getCarbonOffset('astrotomic');
$ecologi->reporting()->getImpact('astrotomic');

// Purchasing API
$ecologi->purchasing(test: false)->buyTrees(10, name: 'Gummibeer', idempotency: '1234567890');
$ecologi->purchasing(test: false)->buyCarbonOffset(500, unit: CarbonUnit::KG, idempotency: '1234567890');