PHP code example of lujunsan / metabase-php-api

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

    

lujunsan / metabase-php-api example snippets


/*
 * url: Full URL of the Metabase application (https://metabase.unicorn.com)
 * username: Username of the account that will make the API calls
 * password: Password of username above
*/

$client = new MetabaseClient($url, $username, $password);

/*
 * questionId: Id of the question (query) that will be executed and retrieved
 * format: Optional, defaults as json
 * parameters: Optional, defaults empty, any extra parameters that will be sent in the API call
*/

$client->getQuestion($questionId, $format, $parameters);