View
The View package is Quantum's page-level rendering layer.
Use it when you need more than a raw template render: layouts, shared view parameters, asset registration, page caching, and safe default escaping all live here.
What the package provides
Quantum\View\Viewfor full-page and partial renderingQuantum\View\Factories\ViewFactoryfor resolving the shared view instance- helper functions such as
view(),partial(), andview_param() RawParamfor explicitly unescaped values
When to use it
Use the View package when your request should render a page inside a layout:
view()->setLayout('layouts/main', [
'css' => [
'/css/app.css',
],
]);
$html = view()->render('pages/home', [
'title' => 'Dashboard',
'user' => $user,
]);
Use renderPartial() when you only need a fragment and do not want layout, asset, debugger, or cache behavior.
Default rendering behavior
Before a value reaches the renderer, the package HTML-escapes every string parameter recursively.
That applies to:
- direct string params
- arrays containing strings
- object properties containing strings
If you need trusted HTML to pass through unchanged, wrap that value in RawParam or create it with raw_param().
Important constraints
- Full
render()requires a layout. If no layout is set, it throws aViewException. - The factory returns a shared
Viewinstance, so params, layout state, and layout asset definitions continue across helper calls in the same container lifecycle. getContent()returns the body from the most recent fullrender(). Partial renders keep that previous full-render content in place.- The package delegates template lookup and adapter selection to the Renderer package.