iracode-com/filament-excel-pro
Composer 安装命令:
composer require iracode-com/filament-excel-pro
包简介
Filament plugin for advanced Excel file data entry based on `SpartanNL/Laravel-Excel` package
README 文档
README
SpartanNL/Laravel-Excel for Filament with advanced functionality
This package provides a Filament resource to add advanced functionality for importing data from excel files based on SpartanNL/Laravel-Excel package
Requirements
- Laravel v11
- Filament v3
- SpartanNL/Laravel-Excel v3
Languages Supported
Filament Excel Pro Plugin is translated for :
- us English
- fa Farsi
Installation
You can install the package via composer:
composer require iracode-com/filament-excel-pro
After that run the install command:
php artisan filament-excel-pro:install
This will publish the config & migrations & translations from iracode-com/filament-excel-pro
And run migrates
php artisan migrate
You can manually publish the configuration file with:
php artisan vendor:publish --tag="filament-excel-pro-config"
This is the contents of the published config file:
return [ /* * This model will be used to import. */ 'import_model' => \IracodeCom\FilamentExcelPro\Model\Importable::class, /* * This model will be determined as user model. * creator, updater: foreign key columns in import model for creator, updater relationships */ 'user' => [ 'model' => \App\Models\User::class, 'creator' => 'created_by', 'updater' => 'updated_by' ], /* * This is the name of the table that will be created by the migration and * used by the Import model shipped with this package. */ 'table' => 'importables', 'resources' => [ 'label' => 'Excel Import', 'plural_label' => 'Excel Imports', 'navigation_group' => null, 'navigation_icon' => 'heroicon-o-clipboard-document-check', 'navigation_sort' => null, 'navigation_count_badge' => false, 'resource' => \IracodeCom\FilamentExcelPro\Resources\ImportableResource::class, ], 'datetime_format' => 'd/m/Y H:i:s', ];
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-excel-pro-views"
Usage
Basic SpartanNL Laravel Excel usage
In your AppServiceProvider add HeadingRowFormatter::default('none') method to disable formatting
use Illuminate\Support\ServiceProvider; use Maatwebsite\Excel\Imports\HeadingRowFormatter; class AppServiceProvider extends ServiceProvider { /** * Register any application services. */ public function register(): void { // } /** * Bootstrap any application services. */ public function boot(): void { HeadingRowFormatter::default('none'); } }
Plugin usage
In your Panel ServiceProvider (App\Providers\Filament) active the plugin
Add the IracodeCom\FilamentExcelPro\FilamentExcelProPlugin to your panel config
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make(), ]); }
Customising the ImportableResource
You can swap out the ImportableResource used by updating the ->resource() value. Use this to create your own CustomResource class and extend the original at \IracodeCom\FilamentExcelPro\Resources\ImportableResource::class. This will allow you to customise everything such as the views, table, form and permissions.
Note
If you wish to change the resource on List and View page be sure to replace the getPages method on the new resource and create your own version of the ListPage and ViewPage classes to reference the custom CustomResource.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->resource(\Path\For\Your\CustomResource::class), ]); }
Customising label Resource
You can swap out the Resource label used by updating the ->label() and ->pluralLabel() value.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->label('Excel import') ->pluralLabel('Excel imports'), ]); }
Grouping resource navigation items
You can add a Resource navigation group updating the ->navigationGroup() value.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->navigationGroup('Excel import'), ]); }
Customising a resource navigation icon
You can swap out the Resource navigation icon used by updating the ->navigationIcon() value.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->navigationIcon('heroicon-o-clipboard-document-check'), ]); }
Active a count badge
You can active Count Badge updating the ->navigationCountBadge() value.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->navigationCountBadge(true), ]); }
Set navigation sort
You can set the Resource navigation sort used by updating the ->navigationSort() value.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->navigationSort(3), ]); }
Authorization
If you would like to prevent certain users from accessing the logs resource, you should add a authorize callback in the FilamentExcelProPlugin chain.
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->authorize( fn () => auth()->user()->id === 1 ), ]); }
Full configuration
use IracodeCom\FilamentExcelPro\FilamentExcelProPlugin; public function panel(Panel $panel): Panel { return $panel ->plugins([ FilamentExcelProPlugin::make() ->resource(\Path\For\Your\CustomResource::class) ->label('Excel import') ->pluralLabel('imports') ->navigationGroup('Excel import') ->navigationIcon('heroicon-o-shield-check') ->navigationCountBadge(true) ->navigationSort(2) ->authorize( fn () => auth()->user()->id === 1 ), ]); }
Changelog
Please see CHANGELOG for more information on what has changed recently.
Acknowledgements
Special acknowledgment goes to these remarkable tools and people (developers), the Excel import plugin only exists due to the inspiration and at some point the use of these people's codes.
Credits
License
The MIT License (MIT). Please see License File for more information.
iracode-com/filament-excel-pro 适用场景与选型建议
iracode-com/filament-excel-pro 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 1, 最近一次更新时间为 2024 年 08 月 25 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「excel」 「import」 「export」 「laravel」 「filament」 「filament-excel」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 iracode-com/filament-excel-pro 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 iracode-com/filament-excel-pro 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 iracode-com/filament-excel-pro 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
This Symfony bundle integrates PhpSpreadsheet into Symfony using Twig.
Bulk export of sylius resources
Parse use statements for a reflection object
Tool for copying data from a production database to a dev database. Also useful for making backups of production databases.
PHPExcel - OpenXML - Read, Create and Write Spreadsheet documents in PHP - Spreadsheet engine
A fork of konnco/filament-import with support of Laravel 11 since the default importer of Filament 3 is nonsense for basic use case.
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 25
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2024-08-25