PHP code example of riipandi / php-metabase

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

    

riipandi / php-metabase example snippets




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

$metabase = new \Metabase\Embed($metabaseUrl, $metabaseKey);

// Generate the HTML to create an iframe with the embedded dashboard
echo $metabase->dashboardIframe($dashboardId, $params);



return [
    'url' => env('METABASE_URL', 'http://localhost:3000'),
    'key' => env('METABASE_KEY'),
]



$metabaseUrl = config('metabase.url');    // The url of the metabase installation
$metabaseKey = config('metabase.key');    // The metabase secret embed key
$dashboardId = 1;                         // The id of the dashboard (from the url)
$params = ['date' => 'past26weeks'];      // Any parameters to pass to the dashboard (optional)

$metabase = new \Metabase\Embed($metabaseUrl, $metabaseKey);

// Generate the HTML to create an iframe with the embedded dashboard
echo $metabase->dashboardIframe($dashboardId, $params);