CI 4 Default Landing Page

When we install CodeIgniter 4, we should see a default landing page which will be something like this.

How can we find it’s files from where it is coming.

Default Controller

Go inside /app/Controllers folder, you will see we have a default called Home.php.

Open that controller, it will be like this.

<?php

namespace App\Controllers;

class Home extends BaseController
{
	public function index()
	{
		return view('welcome_message');
	}
}

So, this is application default controller after installation. Inside this index() method we can see we have a view file attached welcome_message.

Default View File

Go inside /app/Views folder. We will see a default view file welcome_message.php. Inside that file we will have all the code which is responsible to render the output of landing page.

Default Route

Open Routes.php file from /app/Config folder. We will see we have default route in it as –

$routes->get('/', 'Home::index');

This route means – For landing page it has to run index() method from Home Controller. And inside index() method application returns welcome_message.php view file.

Sanjay KumarHello friends, I am Sanjay Kumar a Web Developer by profession. Additionally I'm also a Blogger, Youtuber by Passion. I founded Online Web Tutor and Skillshike platforms. By using these platforms I am sharing the valuable knowledge of Programming, Tips and Tricks, Programming Standards and more what I have with you all. Read more