Search by

marko / validation-database

markshust

Entity-backed Exists and Unique validation rules for Marko Framework

Package info

github.com/marko-php/marko-validation-database

Type:marko-module

pkg:composer/marko/validation-database

Statistics

Installs: 2

Dependents: 0

Suggesters: 1

Stars: 0

0.13.0 2026-11-03 16:54 UTC

This package is auto-updated.

Last update: 2026-11-03 19:24:18 UTC


README

Entity-backed Exists and Unique validation rules --- looks records up by entity class and property through marko/database.

Installation

composer require marko/validation-database

Requires marko/database and a database driver. Installing the package binds RecordLookupInterface; no configuration is needed.

Quick Example

use App\Blog\Entity\Channel;
use App\Blog\Entity\User;
use Marko\Validation\Rules\RecordRules;

public function __construct(
    private readonly RecordRules $recordRules,
) {}

$rules = [
    'channel_id' => ['required', $this->recordRules->exists(Channel::class)],
    'email' => ['required', 'email', $this->recordRules->unique(User::class, 'email')->caseInsensitive()->ignore($user->id)],
];

Documentation

Full usage, API reference, and examples: marko/validation-database