# 在 Laravel Pulse 面板上看 Hibira 用量

> 一張 Pulse 卡片，把連線數、訊息數和傳送資料量與方案上限並列顯示，附上跟隨 Pulse 時段切換的走勢圖，以及此刻最熱門的頻道。

Source: https://hibira.io/zh-tw/guides/pulse

一張 Pulse 卡片，把連線數、訊息數和傳送資料量與方案上限並列顯示，附上跟隨 Pulse 時段切換的走勢圖，以及此刻最熱門的頻道。

Package: hibira-io/pulse

- 目前連線數與時段內高峰對照方案上限，今日訊息數對照每日上限，讓你比使用者更早發現快到上限。
- 依訂閱人數排序的最熱門頻道，用 app 的 key 與 secret 從 Channels HTTP API 讀取。
- 不會寫入 Pulse 的資料表：每次數值都從 Hibira 取得，並快取 60 秒。

## 1. 安裝

```shell
composer require hibira-io/pulse
```

## 2. 設定

```ini
# A personal API token with read access, from https://hibira.io/portal/api-tokens
HIBIRA_API_TOKEN=hkb_pat_...
HIBIRA_APP_ID=YOUR_APP_ID
# Optional: the key and secret turn on the channel list
HIBIRA_APP_KEY=YOUR_APP_KEY
HIBIRA_APP_SECRET=YOUR_APP_SECRET
```

## 3. 使用

```html
{{-- resources/views/vendor/pulse/dashboard.blade.php --}}
<x-pulse>
    <livewire:hibira.usage cols="6" rows="2" />
    ...
</x-pulse>
```

## 開始之前

- 請把 API token 限定在這個 app，且只給讀取權限：卡片不會變更任何東西。
- 如果你的 app 還沒有 Pulse 面板的 view，請先執行 php artisan vendor:publish --tag=pulse-dashboard。

- [Packagist](https://packagist.org/packages/hibira-io/pulse)
- [GitHub](https://github.com/hibira-io/pulse)
