PHPackages                             tombenevides/metavel - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. tombenevides/metavel

ActiveLibrary

tombenevides/metavel
====================

A package to integrate Metabase to Laravel

0.0.2(3y ago)2219.2k↑866.7%2[1 issues](https://github.com/tombenevides/metavel/issues)MITPHP

Since Mar 19Pushed 3y ago1 watchersCompare

[ Source](https://github.com/tombenevides/metavel)[ Packagist](https://packagist.org/packages/tombenevides/metavel)[ RSS](/packages/tombenevides-metavel/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (2)Dependencies (3)Versions (3)Used By (0)

[![](https://camo.githubusercontent.com/303fae7deb5341498a133ccf3a6ec95148761dbf8f26a366c41f002145332650/68747470733a2f2f62616e6e6572732e6265796f6e64636f2e64652f4d65746176656c2e706e673f7468656d653d6c69676874267061636b6167654d616e616765723d636f6d706f7365722b72657175697265267061636b6167654e616d653d746f6d62656e6576696465732532466d65746176656c267061747465726e3d617263686974656374267374796c653d7374796c655f31266465736372697074696f6e3d53696d706c652b7761792b746f2b696e746567726174652b4d657461626173652b776974682b4c61726176656c266d643d312673686f7757617465726d61726b3d3026666f6e7453697a653d313030707826696d616765733d63686172742d706965)](https://github.com/tombenevides)

 [![Total Downloads](https://github.com/tombenevides/metavel/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/tombenevides/metavel/actions) [![Issues Open](https://camo.githubusercontent.com/4b65f9e1791e194bd80374e6fc06b3ae59e18f6afb0a6d19e56fb3736cfefaf4/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6973737565732f746f6d62656e6576696465732f6d65746176656c)](https://github.com/tombenevides/metavel/issues) [![Total Downloads](https://camo.githubusercontent.com/8c34d92ee24b220a3fe9a537bd8f737dd435a259029f0bd7843b6649491c783a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6d62656e6576696465732f6d65746176656c)](https://packagist.org/packages/tombenevides/metavelr) [![Latest Version](https://camo.githubusercontent.com/4cc8b55466e3fe093ae264228c13bfc9853334338d1a032ac84d2aa05b2b8e8a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6d62656e6576696465732f6d65746176656c)](https://packagist.org/packages/tombenevides/metavel) [![License](https://camo.githubusercontent.com/66ca2b4281c5d6639dc781e39aeb775bdc75abeb12089c67f2e59c31c5c7d243/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6d62656e6576696465732f6d65746176656c)](https://packagist.org/packages/tombenevides/metavel)

---

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.

[![image](https://user-images.githubusercontent.com/18440704/226209981-defde2b1-5fb3-42da-8d6f-f9088f68e10f.png)](https://user-images.githubusercontent.com/18440704/226209981-defde2b1-5fb3-42da-8d6f-f9088f68e10f.png)

REQUIREMENTS
------------

[](#requirements)

> **[PHP 8.1+](https://www.php.net/releases/)**
>
> **[Laravel 10](https://github.com/laravel/laravel)**

HOW TO INSTALL
--------------

[](#how-to-install)

To install the package, just use [composer](https://getcomposer.org):

```
composer require tombenevides/metavel
```

HOW TO USE
----------

[](#how-to-use)

### Configuring Metabase credentials

[](#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

[](#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:

```

```

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:

PropertyTypedefault valueDescriptionparamsarray\[ \]if your question/dashboard have implicit filtersborderedbooleantrueto load (or not) borders in the elementtitledbooleantrueto load (or not) the element original titledarkThemebooleanfalseto load (or not) the element with dark themewidthint1366set the width of the elementheightint768set the height of the element### Styling

[](#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::

```

```

This will generate:

```
