PHP code example of dannyguevara1 / zest

1. Go to this page and download the library: Download dannyguevara1/zest 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/ */

    

dannyguevara1 / zest example snippets


// En config/zest.php
'presets' => [
    'btn' => 'inline-flex items-center justify-center font-medium rounded',
    'btn-primary' => 'bg-blue-600 text-white hover:bg-blue-700',
    'card' => 'bg-white rounded-lg shadow overflow-hidden',
],

// O mediante código
use Dannyguevara1\Zest\Facades\Zest;

Zest::definePreset('btn', 'inline-flex items-center justify-center font-medium rounded');
Zest::definePresets([
    'btn-primary' => 'bg-blue-600 text-white hover:bg-blue-700',
    'card' => 'bg-white rounded-lg shadow overflow-hidden',
]);

// Botones
'btn' => 'base-styles...',
'btn-primary' => 'variant-styles...',
'btn-sm' => 'size-styles...',

// Tarjetas
'card' => 'base-styles...',
'card-header' => 'part-styles...',
'card-body' => 'part-styles...',

// AppServiceProvider.php
public function boot()
{
    Zest::definePresets([
        'btn' => 'inline-flex items-center justify-center font-medium transition-colors rounded-md',
        'btn-primary' => 'bg-blue-600 text-white hover:bg-blue-700',
        'btn-secondary' => 'bg-gray-200 text-gray-800 hover:bg-gray-300',
        'btn-sm' => 'text-sm px-3 py-1.5',
        'btn-md' => 'px-4 py-2',
        'btn-lg' => 'text-lg px-5 py-3',
    ]);
}

// AppServiceProvider.php
public function boot()
{
    Zest::definePresets([
        'table' => 'min-w-full divide-y divide-gray-200',
        'table-head' => 'bg-gray-50',
        'table-th' => 'px-6 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider',
        'table-body' => 'bg-white divide-y divide-gray-200',
        'table-td' => 'px-6 py-4 whitespace-nowrap text-sm text-gray-500',
    ]);
}
bash
php artisan vendor:publish --tag=zest-config
blade
<!-- table.blade.php -->
<table class="@preset('table')">
    <thead class="@preset('table-head')">
        <tr>
            @foreach($headers as $header)
                <th class="@preset('table-th')">{{ $header }}</th>
            @endforeach
        </tr>
    </thead>
    <tbody class="@preset('table-body')">
        @foreach($rows as $row)
            <tr>
                @foreach($row as $cell)
                    <td class="@preset('table-td')">{{ $cell }}</td>
                @endforeach
            </tr>
        @endforeach
    </tbody>
</table>