PHP code example of cyberhorse / metabase-php

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

    

cyberhorse / metabase-php example snippets



he url of the metabase installation
$metabaseUrl = '[metabase_url]';
// The secret embed key from the admin settings screen
$metabaseKey = '[metabase_key]';
// The id of the dashboard (from the url)
$dashboardId = 1;
// Any parameters to pass to the dashboard
$params = ['date' => 'past26weeks'];

$metabase = new \Metabase\Embed($metabaseUrl, $metabaseKey);
// Generate the HTML to create an iframe with the embedded dashboard
echo $metabase->dashboardIframe($dashboardId, $params);