mixed view(string $html_file [, array $parameters])

Returns an parsed version of an HTML file that is loaded from your apps /views folder. Commonly used as a return method in routes.



HTML file name.

$parameters (optional)

An array of parameters to pass to the template.


route('/foo', function() {

   // Loads HTML file from your apps /views folder
   return view('index.html', [
      'foo' => 'bar'

In this example our HTML index.html could look like

<h1>Hello World!</h1>
   {{ foo }}