PHP code example of pepperfm / filament-json

1. Go to this page and download the library: Download pepperfm/filament-json library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

pepperfm / filament-json example snippets


use PepperFM\FilamentJson\Columns\JsonColumn;

JsonColumn::make('properties');

JsonColumn::make('properties')
    ->asDrawer();

JsonColumn::make('properties')
    ->asModal();

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);

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;
}
bash
php artisan vendor:publish --tag="filament-json-config"
bash
php artisan vendor:publish --tag="filament-json-views"