ehsan9/metabase-laravel
最新稳定版本:v1.0
Composer 安装命令:
composer require ehsan9/metabase-laravel
包简介
connect to the Metabase web service in Laravel project and have the output of reports
README 文档
README
First Metabase should be installed . You can get more info Here.
Installation
Step 1 - Install the package
You can install ehsan9/metabase-laravel with Composer directly in your project:
$ composer require ehsan9/metabase-laravel
Step 2 - Publish
Run this command in your project directory:
php artisan vendor:publish --provider="Ehsan9\MetabaseLaravel\MetabaseServiceProvider"
Step 3 - Set config
Now you must define your Metabase Url, Username and Password to project. for this head to config/metabase-api.php then put your metabase info in the code:
return [ 'url' => 'https://yoursmetabase.com', 'username' => 'your_metabase_username', 'password' => 'your_metabase_pass' ];
Usage
You can use the package where ever you want.
-
Method 1:
- First use the class:
use Ehsan9\MetabaseLaravel\MetabaseApi;
- Then use this pattern to connect Metabase api:
$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);
-
Method 2:
- use MetabaseApi Facade in ServiceProvider
use Ehsan9\MetabaseLaravel\Facades\MetabaseApi;
- then use this pattern
MetabaseApi::getQuestion('questionId');
统计信息
- 总下载量: 303
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-12-29