adereksisusanto/filament-shlink
Composer 安装命令:
composer require adereksisusanto/filament-shlink
包简介
This is my package filament-shlink
README 文档
README
Filament panel integration for Shlink, a self-hosted URL shortener. Manage short URLs and tags directly from your Filament panel.
Installation
composer require adereksisusanto/filament-shlink
Publish Config
php artisan vendor:publish --tag="filament-shlink-config"
Register Plugin
// AppServiceProvider.php or PanelProvider use Adereksisusanto\FilamentShlink\FilamentShlinkPlugin; public function panel(Panel $panel): Panel { return $panel ->plugin(FilamentShlinkPlugin::make()); }
Modal Mode
By default, create and edit actions navigate to dedicated pages. To use modal forms instead:
FilamentShlinkPlugin::make()->modal(true)
Configure modal appearance with named parameters using enums:
use Adereksisusanto\FilamentShlink\Enums\ModalType; use Filament\Support\Enums\Alignment; use Filament\Support\Enums\SlideOverPosition; use Filament\Support\Enums\Width; FilamentShlinkPlugin::make()->modal( enabled: true, type: ModalType::SlideOver, position: SlideOverPosition::End, width: Width::FourExtraLarge, alignment: Alignment::Center, )
Multi-Client (Per-User Config)
Enable per-user Shlink connections. Each authenticated user can configure their own Shlink server via Shlink Settings:
FilamentShlinkPlugin::make()->multiClient()
Customize the database table prefix:
FilamentShlinkPlugin::make()->multiClient(tablePrefix: 'myapp')
This creates the myapp_configs table (default fs_configs). When enabled, publish & run the migration:
php artisan vendor:publish --tag="filament-shlink-migrations"
php artisan migrate
Per-user data is scoped per user. Falls back to global .env config if user has no saved config.
Configuration
Set your Shlink server URL and API key in .env:
SHLINK_SERVER_URL=https://your-shlink-server.com SHLINK_API_KEY=your-api-key
Or configure them via Shlink Settings page in the Filament admin panel after registration.
Published config (config/filament-shlink.php):
return [ 'server_url' => env('SHLINK_SERVER_URL', ''), 'api_key' => env('SHLINK_API_KEY', ''), 'table_prefix' => 'fs', ];
Features
- Short URLs — List, create, and edit short URLs
- Tags — List, rename, and delete tags
- Dashboard Widget — Visits overview widget showing total visits, short URLs, and tags
- Settings — Configure server connection from the admin panel
- Multi-Client — Per-user Shlink connections (stored in
{prefix}_configs)
Usage
Once registered, the plugin adds the following to your Filament panel:
- Dashboard Widget —
VisitsOverviewWidgetdisplays total visits, short URL count, and tag count (appears on the Short URLs page) - Short URLs — View all short URLs, create new ones, edit existing ones
- Tags — Manage tags (rename, delete)
Shlink URLs, tags, and visits are fetched directly from the Shlink API — no local tables for those. When
multiClient()is enabled, per-user connection settings are stored in the{prefix}_configstable.
Requirements
- PHP ^8.3
- Filament ^5.0
- Laravel ^11.0|^12.0
Testing
composer test
The test suite covers:
- Models — ShortUrl, Tag, and TagStats creation from Shlink SDK DTOs
- Service — Configuration state, connection setup via
setConfig() - Widget — Visits overview widget handles configured and unconfigured states
- Service Provider — Singleton registration, config/translation/view loading
- Architecture — Debug functions (
dd,dump,ray) are not used anywhere in the source
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.
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 2
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-07-06