HTTP Fundamentals

Views

Render escaped HTML templates with explicit support for trusted raw HTML.

Beta · v0.2.0Lanjit APIs may change before the stable release. Review the release notes and upgrade guide before updating.

Views live in resources/views and use the .html extension. Dot notation maps to nested directories. Double braces escape HTML by default, while {!! value !!} renders raw HTML and must only be used with trusted or sanitized content.

Examples

Route.get('/users/{user}', async (request, response) => {
  return response.view('users.profile', {
    title: 'Profil pengguna',
    user: { name: 'Ayu' },
  });
});
export class HomeController {
  index(request, response) {
    return response.view('welcome', {
      title: 'Selamat datang di Lanjit',
    });
  }
}
<h1>{{ title }}</h1>
<p>{{ user.name }}</p>
<article>{!! renderedMarkdown !!}</article>
Edit this page on GitHub

Type to search all documentation.