Params PHP in Embedding Dashboard Metabase

Hello guys, today I will show for you how to put more than one parameter in embedding dashboard with Metabase and PHP:

First, you need import the library lcobucci using the composer, after that, create the code below with your App and you can see two parameters working fine:

    $metabaseSiteUrl = 'http://localhost:3000';
    $metabaseSecretKey = 'KEY_SECRET';
                  
    $signer = new Sha256();
    $token = (new Builder())

    ->set('resource', ['dashboard' => 1])
    ->set('params', ['your_column_from_query' => null])
    ->set('params',['your_another_column_from_query' => null])

    ->sign($signer, $metabaseSecretKey)
    ->getToken();

$iframeUrl ="$metabaseSiteUrl/embed/dashboard/$token#bordered=false&titled=false";
  • See the 2 parameters above:
    We have: “your_column_from_query” that is the your column from query that you to do the filter;
    “your_another_column_from_query” is it the second column from query that you to do filter.

Thats way you can create any PARAMS to put in your dashboard embedded in PHP.

Best regards,
Ed.