tombenevides/metavel
Composer 安装命令:
composer require tombenevides/metavel
包简介
A package to integrate Metabase to Laravel
README 文档
README
Metabase is an open source business intelligence platform where you can create charts/grids (known as questions) or a collection of questions (known as dashboards) as a custom visualization for your data. One of Metabase's features is embedding. Therefore, this package provides blade components that abstract the platform integration, allowing you to easily embed your question/dashboard in a Laravel application.
REQUIREMENTS
HOW TO INSTALL
To install the package, just use composer:
composer require tombenevides/metavel
HOW TO USE
Configuring Metabase credentials
After installing, publish your config file using:
php artisan vendor:publish --tag=metavel-config
This will create a metavel.php file in your config folder. There, you'll see the environment variables to set the Metabase's base url and secret key.
METAVEL_BASE_URL #Metabase base url METAVEL_SECRET_KEY #Metabase secret key
You will also find in the config file a expiration_time option. Since the communication between Laravel and Metabase works with JWT, using this option you can set an exp date for you generated token. The value is in seconds using NumericDate format.
Call the component
After setting the platform credentials, you just need to call the match component in your blade file. There's two components, one for questions and other for dahsboards:
<body> <x-metavel-question :resource=89 /> <x-metavel-dashboard :resource=10 /> </body>
The components have some properties that you can set to customize the embbeding. Most of them are optional, except for resource, which is the ID of the element on Metabase (question or dashboard). Besides that, you can also set:
| Property | Type | default value | Description |
|---|---|---|---|
| params | array | [ ] | if your question/dashboard have implicit filters |
| bordered | boolean | true | to load (or not) borders in the element |
| titled | boolean | true | to load (or not) the element original title |
| darkTheme | boolean | false | to load (or not) the element with dark theme |
| width | int | 1366 | set the width of the element |
| height | int | 768 | set the height of the element |
Styling
As a blade component, you can add HTML attributes as classes for styling, for example. The Metabase element is loaded in an iframe but it's encapsulated by a div that receives the attributes, as shown below::
<body> <x-metavel-question :resource=89 class="w-full" /> </body>
This will generate:
<div class="w-full"> <iframe.... </div>
LICENSE
Metavel is a software under the MIT License
UPDATES
👋 Follow the author @devatreides on Twitter to know more about the last updates and other projects. Say Hi!
tombenevides/metavel 适用场景与选型建议
tombenevides/metavel 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 19.68k 次下载、GitHub Stars 达 23, 最近一次更新时间为 2023 年 03 月 19 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 tombenevides/metavel 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 tombenevides/metavel 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 19.68k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 23
- 点击次数: 18
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2023-03-19
