PHP code example of beyondcode / fathom-api

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

    

beyondcode / fathom-api example snippets


$analytics = new BeyondCode\FathomAnalytics($email, $password);

$sites = $analytics->getSites();

$analytics->getCurrentVisitors($siteId);

// Returns the visitor data for today
$analytics->getData($siteId);

// Returns the visitor data for the whole week until today
$analytics->getData($siteId, Carbon::now()->startOfWeek());

// Returns the visitor data for two days ago until yesterday.
$analytics->getData($siteId, Carbon::now()->subDays(2), Carbon::now()->subDays(1));