PHP code example of ehsan9 / metabase-laravel

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

    

ehsan9 / metabase-laravel example snippets


return [
    'url' => 'https://yoursmetabase.com',
    'username' => 'your_metabase_username',
    'password' => 'your_metabase_pass'
];

    use Ehsan9\MetabaseLaravel\MetabaseApi;
  

    $metabaseApi = new \Ehsan9\MetabaseLaravel\MetabaseApi(
        config('metabase-api.url'), config('metabase-api.username'), config('metabase-api.password')
    );
            $parameters = [
                [
                    "type" => "category",
                    "value" => "YOUR_VALUE",
                    "target" => [
                        "variable",
                        [
                            "template-tag",
                            "member_id"
                        ]
                    ]
                ]
            ];
    
    $result = $metabaseApi->getQuestion('questionId', 'json', $parameters);
  

  use Ehsan9\MetabaseLaravel\Facades\MetabaseApi;
    

    MetabaseApi::getQuestion('questionId');
  
sh
php artisan vendor:publish --provider="Ehsan9\MetabaseLaravel\MetabaseServiceProvider"