Search by

marko / forms

markshust

Server-rendered form round trips for Marko Framework - redirect back with flashed validation errors and old input, plus csrf_field/old/errors template helpers

Package info

github.com/marko-php/marko-forms

Type:marko-module

pkg:composer/marko/forms

Statistics

Installs: 3

Dependents: 1

Suggesters: 1

Stars: 0

0.13.0 2026-11-01 12:48 UTC

This package is auto-updated.

Last update: 2026-11-03 19:19:06 UTC


README

Server-rendered form round trips for Marko --- redirect back with flashed validation errors and old input, plus csrf_field(), old() and errors() template helpers for Latte and Twig.

Installation

composer require marko/forms

Quick Example

use Marko\Routing\Attributes\Post;

#[Post('/register')]
public function store(Request $request): Response
{
    // On failure: 303 back to the form with the errors and old input flashed
    $this->validator->validateOrFail($request->post(), ['email' => ['required', 'email']]);

    return Response::redirect('/welcome', 303);
}
<form method="post">
    {csrf_field()}
    <input name="email" value={old('email')}>
    {if $errors->has('email')}<p>{$errors->first('email')}</p>{/if}
</form>

Documentation

Full usage, API reference, and examples: marko/forms