Laravel Hello World Application

Today, We are going to see the Larave Hello World application step by step. In this tutorial, we will covert all this basic stuff like Controller, Views, Routes. We going to create a single route and print the Hello World message using Laravel views. 


Laravel is a full-framework for all kind of application. Hence, Laravel is the most popular highest rating framework on Github. Laravel is easy to use, with a simple learning curve, and a minimum number of steps required to get an app or website up and running.

First of all, Install Laravel if you don't install by following this article. 

Laravel Hello World Application

We are going to learn Laravel 5 Hello World Application step by step.


A route is a URL pattern that is mapped to a handler. Laravel route directs an incoming request to function or controller. Also, a route is a store on the "routes" directory. Let's create the route for Hello World Application.

Let's Open "routes/web.php" file for creating the route.

Route::get('/hello-world', function () {
    return view('helloworld');

Laravel allows us to call view file directly from the Route. Now, let's create the route that calls view file from Controller.

Route::get('/hello-world', 'HelloworldController@HelloWorld');

Finally, The Route is ready for "Hello World" application Now, Let's move for the Controller.


Instead of defining all of your logic in the route files,  You may wish to create Controller class for organizing the logic. Controllers can group related request handling logic into a single class. Controllers are store in the app/Http/Controllers directory.

Let's create the "HelloworldController.php" File at the "app/Http/Controllers" Folder or else we can generate Controller file by following artisan command.

php artisan make:controller HelloworldController

After, Creating the Controller let's create the "HelloWorld" method

namespace App\Http\Controllers;
use App\User;
use App\Http\Controllers\Controller;
class HelloworldController extends Controller
     * Show the profile for the given user.
     * @return Response
    public function HelloWorld($id)
        return view('helloworld');

Finally, We are ready with Controller. We just call view file using Controller class instead of the Route. Now, let's we are going to create the view file.


View file contains the HTML served by your application and separate your controller/application logic from your presentation logic. Views are store in the resources/views directory.

        <h2>LaravelHive - Laravel 5 Hello World!</h2>

Finally, We are ready for the Laravel 5 Hello World Application. Now, let's run the application and see the output.

Run the laravel application by the following command.

php artisan server

Now, Running the Laravel 5 application by following the URL "http://localhost:8000/hello-world"


Related Posts: