Laravel Hello World Example (Basic)


Accessing pages and outputting data is fairly easy in Laravel. All of the page routes are located in app/routes.php. There are usually a few examples to get you started, but we're going to create a new route. Open your app/routes.php, and paste in the following code:

Route::get('helloworld', function () {
    return '<h1>Hello World</h1>';

This tells Laravel that when someone accesses http://localhost/helloworld in a browser, it should run the function and return the string provided.