pepperfm / filament-json
Filament plugin for processing JSON field
Fund package maintenance!
pepperfm
Installs: 2 767
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 1
Forks: 0
Open Issues: 0
Requires
- php: ^8.2
- filament/filament: ^3.0
- illuminate/support: ^10.45|^11.0
- spatie/laravel-package-tools: ^1.15.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.59
- larastan/larastan: ^2.0.1
- laravel/pint: ^1.0
- nunomaduro/collision: ^7.9
- orchestra/testbench: ^8.0
- pestphp/pest: ^2.1
- pestphp/pest-plugin-arch: ^2.0
- pestphp/pest-plugin-laravel: ^2.0
- pestphp/pest-plugin-livewire: ^2.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan-deprecation-rules: ^1.0
- phpstan/phpstan-phpunit: ^1.0
- spatie/laravel-ray: ^1.26
README
Installation
You can install the package via composer:
composer require pepperfm/filament-json
You can publish the config file with:
php artisan vendor:publish --tag="filament-json-config"
Optionally, you can publish the views using
php artisan vendor:publish --tag="filament-json-views"
Usage
use PepperFM\FilamentJson\Columns\JsonColumn; JsonColumn::make('properties'); JsonColumn::make('properties') ->asDrawer(); JsonColumn::make('properties') ->asModal();
Customize button and modal props:
use PepperFM\FilamentJson\Columns\JsonColumn; $buttonConfig = [ 'color' => 'warning', 'size' => 'xs', ]; $modalConfig = literal( icon: 'heroicon-m-sparkles', alignment: 'start', width: 'xl', closedButton: false, ); JsonColumn::make('properties') ->asModal() ->button($buttonConfig) ->modal($modalConfig);
The button()
and modal()
method accept the type of array|Arrayable|\stdClass
, and implements basic properties of button and modal blade components from Filament documentation: Core Concepts - Blade Components
Here is the DTO classes that implements components configuration:
class ButtonConfigDto { public string $color = 'primary'; public string $icon = 'heroicon-o-swatch'; public ?string $label = null; public ?string $tooltip = null; public string $size = 'md'; public ?string $href = null; public ?string $tag = null; } class ModalConfigDto { public ?string $id = null; public string $icon = 'heroicon-o-swatch'; public string $iconColor = 'primary'; public string $alignment = 'start'; public string $width = 'xl'; public bool $closeByClickingAway = true; public bool $closedByEscaping = true; public bool $closedButton = true; public bool $autofocus = true; }
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.