Today, We are going to learn Laravel 5 Hello World application. We all hear about the Laravel Framework. Laravel is the most popular object-oriented PHP Framework. Laravel is easy for developing the application and secure framework. We are going to learn step by step Hello World application of Laravel. First of all, We are going to install Laravel.

The composer is required for installing Laravel application. If the composer is not installed then install it first.

Laravel 5 Hello World application

Let’s see how to install the latest version of the Laravel

If you want to install an older version of the Laravel then follow below command.

You have to pass the folder name for installing Laravel my folder name is thecodingstuff. You can change or replace the command with your folder name.

Once the Laravel installation is complete just goto the project directory by the following command.

Now, Let’s run the Laravel project follow the command

Now, You can access the Laravel project by following the link.

If you want to run the Laravel project directly without firing any command. You can follow the below link.

Now, We are going to create the route, controller and view file code. First of all, Let’s create the route.

Create Route

Open the laravel route file for create route. If you install Laravel 5.3 or above version then you will find the route file at “routes/web.php” location. If you install Laravel 5.2 or lower version then you will find the route at “app/Http/routes.php” location.

Let’s open your route file and write the route like.

Laravel provides all types of routes like GET, POST, UPDATE, DELETE etc.. For Now, we create the GET route for Hello World application. The first parameter is the URL prefix “hello-world” and the second parameter is the Controller name and function name.

Create Controller

Let’s create the controller for Hello World example. Create a new file at “app/Http/Controllers/ExampleController.php” location. Now, open the ExampleController.php and write the below code.

Create View

Now, We are going to create a view file. Create a new file at “resources/example.blade.php” location. Open example.blade.php file then writes below code.

The Hello World example is over Now, let’s run the application and check the Hello World example. Open below URL

If you get any error on this page writes the comment below.

Leave a Reply