PHP code example of monorailphp / monorail

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

    

monorailphp / monorail example snippets


use App\Models\User;
use Monorail\Resources\Resource;
use Monorail\Tables\Columns\TextColumn;
use Monorail\Tables\Table;

final class UserResource extends Resource
{
    protected static string $model = User::class;

    public static function table(Table $table): Table
    {
        return $table
            ->columns([
                TextColumn::make('id')->sortable(),
                TextColumn::make('name')->sortable(),
                TextColumn::make('email')->sortable()->copyable(),
            ])
            ->searchable(['name', 'email']);
    }
}

┌───────────┐    UI Schema (JSON)     ┌───────────┐
│  Laravel  │ ──────────────────────► │   React   │
│   (PHP)   │     "render this"       │  (client) │
└───────────┘                         └───────────┘
bash
php artisan monorail:install
bash
php artisan monorail:make-panel Admin
php artisan monorail:make-resource User