REDAXO 6

# YForm: tables as classes

Tables, fields and lists live in the project – migrate creates the tables, the backend shows them under “Data”.

 
 
 

 

**In development:** REDAXO 6 is being built in the 6.x branch of redaxo/core. The examples reflect the state of November 2026 – names and details may still change before the release.

YForm 6 is not stable yet and comes directly from GitHub until then. A table is a class with `#[AsTable]`; `fields()` provides its fields, `list()` the columns of the list in the backend.

 
 

 

## Install YForm

 
 
 
Terminal
 

```
composer config repositories.yform '{"type": "vcs", "url": "https://github.com/yakamara/yform", "no-api": true}'
composer require yakamara/yform:6.x-dev@dev
php bin/console migrate
```

 
 
 
 
 

 

## A table

 
 
 
src/YForm/EventTable.php PHP
 

```
<?php

namespace Project\YForm;

use Yakamara\YForm\Attribute\AsTable;
use Yakamara\YForm\Field\Checkbox;
use Yakamara\YForm\Field\Date;
use Yakamara\YForm\Field\Media;
use Yakamara\YForm\Field\Text;
use Yakamara\YForm\Field\Textarea;
use Yakamara\YForm\Table\ListConfig;
use Yakamara\YForm\Table\Table;

#[AsTable('rex_yf_event', label: 'Termine', icon: 'fa-calendar')]
final class EventTable extends Table
{
    public function fields(): iterable
    {
        yield Text::new('title')->label('Titel')->required()->maxLength(191)->filterable();
        yield Date::new('date')->label('Datum')->required()->filterable();
        yield Textarea::new('text')->label('Beschreibung');
        yield Media::new('image')->label('Bild')->types('jpg', 'png', 'webp');
        yield Checkbox::new('online')->label('Online')->default(true)->filterable();
    }

    public function list(ListConfig $list): ListConfig
    {
        return $list->columns('id', 'title', 'date', 'online')->sortBy('date', 'asc');
    }
}
```

 
 
 

filterable() shows a field in the search next to the list in the backend – without filterable() there is no search there.

 
 

 

## Querying data

Queries start at the table class. Date fields return DateTimeImmutable.

 
 
 
Template oder Modul PHP
 

```
<?php

use Project\YForm\EventTable;

use function Redaxo\Core\View\escape;

$events = EventTable::query()
    ->where('online', 1)
    ->where('date', '>=', date('Y-m-d'))
    ->orderBy('date')
    ->limit(5)
    ->find();

foreach ($events as $event) {
    echo '<h3>' . escape($event->get('title')) . '</h3>';
    echo '<p>' . $event->get('date')->format('d.m.Y') . '</p>';
}
```

 
 
 
 
 

 
 
 

Try it

 

## This site is built with REDAXO 6 and fluid.

 

Sign in, tap “Edit” – and change every text, every image and the whole design right here.

 
 
[How editing works](https://fluid.klxm.de/en/fluid/editing/)[See the technology](https://fluid.klxm.de/en/redaxo-6/technology/)


---

Source: https://fluid.klxm.de/en/redaxo-6/yform/
<style nonce="0b10bd01f831df80b43deedd211927bb">.fs-455c15fee1{--ncss-grid-min:13rem !important}</style>