devlogx/filament-pirsch-dashboard-widget
Composer 安装命令:
composer require devlogx/filament-pirsch-dashboard-widget
包简介
This is my package filament-pirsch-dashboard-widget
README 文档
README
Filament Pirsch Dashboard Widget
This package allows you to integrate a simple analytics dashboard widget for panel.
Screenshots
Installation
You can install the package via composer:
composer require devlogx/filament-pirsch-dashboard-widget
Get the Pirsch access token and add it your env file.
- Visit the Pirsch "Integration" settings page.
- Make sure the correct domain is selected in the top left corner of the page.
- Scroll down to the "Clients" section and press the "Add Client" button.
- Select "oAuth (ID + secret)" as type and enter a description.
- Press the "Create Client" button and copy the generated "Client id and Client secret".
- Add the copied id and secret to your
.envfile:
# ...
PIRSCH_CLIENT_ID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
PIRSCH_CLIENT_SECRET=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
You can publish the config file with:
php artisan vendor:publish --tag="filament-pirsch-dashboard-widget-config"
Optionally, you can publish the translations using
php artisan vendor:publish --tag="filament-pirsch-dashboard-widget-translations"
This is the contents of the published config file:
return [ /* |-------------------------------------------------------------------------- | Pirsch Client id & Client secret |-------------------------------------------------------------------------- | | You can acquire your client id and secret id under | https://dashboard.pirsch.io/settings/integration | */ 'client_id' => env('PIRSCH_CLIENT_ID', null), 'client_secret' => env('PIRSCH_CLIENT_SECRET', null), /* |-------------------------------------------------------------------------- | Stats cache ttl |-------------------------------------------------------------------------- | | This value is the ttl for the displayed dashboard | stats values. You can increase or decrease | this value. | */ 'cache_time' => 300, ];
Usage
Create own Dashboard file
Under Filament/Pages/ create a new file called Dashboard.php with following contents:
<?php namespace App\Filament\Pages; use Devlogx\FilamentPirsch\Concerns\HasFilter; class Dashboard extends \Filament\Pages\Dashboard { use HasFilter; }
Remove the default Dashboard from your PanelProvider
->pages([ //Pages\Dashboard::class, ])
Alternatively if you already have a custom Dashboard, add the HasFilter trait to your Dashboard file.
Add the Widget to your PanelProvider
->widgets([ Widgets\AccountWidget::class, Widgets\FilamentInfoWidget::class, \Devlogx\FilamentPirsch\Widgets\PirschStatsWidget::class,// <-- add this widget ])
Add the plugin to your PanelProvider
->plugins([ \Devlogx\FilamentPirsch\FilamentPirschPlugin::make() ])
Configure the plugin
->plugins([ \Devlogx\FilamentPirsch\FilamentPirschPlugin::make() ->pirschLink(true) //Direct link to pirsch analytics page ->pollingInterval("60s") //Auto polling interval ->filterSectionIcon("heroicon-s-adjustments-vertical") ->filterSectionIconColor("primary") ->liveVisitorIcon("heroicon-s-user") //First Block | Live Visitors ->liveVisitorColor("primary") //First Block | Live Visitors ->visitorsIcon("heroicon-s-user-group") //Second Block | All Visitors ->visitorsColor("primary") //Second Block | All Visitors ->viewsIcom("heroicon-s-eye") //Third Block | All Page Views ->visitorsColor("primary") //Third Block | All Page Views ->sessionTimeIcon("heroicon-s-clock") //Fourth Block | Avg. Session Time ->sessionTimeColor("primary") //Fourth Block | Avg. Session Time ])
Using the raw Analytics functions
You can use the functions for your own widgets. There are plenty more available.
Get Dashboard link
public function getDashboardLink(): string { return 'https://' . $this->client->getDomain()->subdomain . '.pirsch.io'; }
Defining the Filter
use Devlogx\FilamentPirsch\Concerns\Filter; $filter = (new Filter()) ->setFrom(Carbon::now()->subDays(30)) ->setTo(Carbon::now()) ->setFromTime(Carbon::now()->startOfDay()) ->setToTime(Carbon::now()->endOfDay()) ->setScale(\Devlogx\FilamentPirsch\Enums\Scale::SCALE_DAY) // can be 'SCALE_DAY', 'SCALE_MONTH', 'SCALE_WEEK' or 'SCALE_YEAR' ->setEvent("name of event") ->setEventMetaKey("meta key");
Get different data
use Devlogx\FilamentPirsch\Facades\FilamentPirsch; //Get active visitors $activeVisitors = FilamentPirsch::activeVisitors($filter,false); //Get avg session duration $sessionDuration = FilamentPirsch::sessionDuration($filter,false); //Get visitors $visitors = FilamentPirsch::visitors($filter,false); //Get page views $views = FilamentPirsch::views($filter,false); //Get avg time on page $timeOnPage = FilamentPirsch::timeOnPage($filter,false); //Get events $events = FilamentPirsch::events($filter,false); //Get event meta data $eventMetaData = FilamentPirsch::eventMetaData($filter,false); //Get languages $languages = FilamentPirsch::languages($filter,false); //Get referrer listed $referrer = FilamentPirsch::referrer($filter,false); //Get os listed $os = FilamentPirsch::os($filter,false); //Get platforms listed $platform = FilamentPirsch::platform($filter,false); //Get a list of used keywords $keywords = FilamentPirsch::keywords($filter,false);
Testing
composer test
Changelog
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING for details.
Security Vulnerabilities
Please review our security policy on how to report security vulnerabilities.
Credits
License
The MIT License (MIT). Please see License File for more information.
devlogx/filament-pirsch-dashboard-widget 适用场景与选型建议
devlogx/filament-pirsch-dashboard-widget 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 237 次下载、GitHub Stars 达 5, 最近一次更新时间为 2024 年 05 月 08 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「laravel」 「devlogx」 「filament-pirsch-dashboard-widget」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 devlogx/filament-pirsch-dashboard-widget 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 devlogx/filament-pirsch-dashboard-widget 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 devlogx/filament-pirsch-dashboard-widget 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This is my package filament-fathom-dashboard-widget
Alfabank REST API integration
Laravel package for Accurate Online API integration.
Shared RCX Laravel DataTables UI and configuration helpers.
Boot a Laravel project on any machine with one command: app:serve installs missing tools (PHP, Node, Composer, Herd, Docker), creates .env, sets up the database, runs migrations, builds assets, starts a queue worker and serves via Herd, Sail or artisan serve; app:down cleanly stops everything it sta
Branded, diagnostic error pages (500, 403, 404, 419, 503) for Filament — native Filament UI, dark mode and translations out of the box.
统计信息
- 总下载量: 237
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 5
- 点击次数: 9
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-05-08

