marwa-framework

Controller API

Marwa\Framework\Controllers\Controller is the framework base controller for application code.

Methods

back() only honors safe referrers. Relative URLs are allowed, and absolute URLs must match the current request origin. Unsafe or missing referrers fall back to the current request URI, then /.

Policy-based authorization is provided by Marwa\Framework\Controllers\Concerns\AuthorizesRequests, which the base controller includes.

Usage

final class PostController extends Controller
{
    public function show(int $id): ResponseInterface
    {
        return $this->view('posts/show', [
            'post' => $id,
        ]);
    }
}

The controller assumes the framework application container is available, so request, session, view, and validation helpers resolve from the shared runtime.