Step by step guide on how to build your first Laravel (blog) application

Laravel 8 , Laravel 7 , PHP , Laravel 6

Nicesnippets

521

09-11-2021


Step by step guide on how to build your first Laravel (blog) application

Hello Friends,

Below is some information on the Laravel framework:

Framework : Laravel

Author : Taylor Otwell

Initial Release Date : June 2011

Current Version : 8 (September 8th, 2020)

Stable Release : 8.11.2 (October 28th, 2020)

The short version, is that Laravel is a PHP MVC Framework. The long version would be, Laravel is a free and open-source PHP Framework for Web Artisans based on Symfony.

It helps craft Web Applications following the MVC (Model View Controller) design pattern. In order for us to better understand Laravel, we will build a simple blog application with Laravel from scratch.

Crafting a new Laravel application


Type the following command:

composer create-project --prefer-dist laravel/laravel my-blog

Configuring our Laravel application

1. Go to http://localhost/phpmyadmin/

2. Create a new Database by clicking on new (shown below in red)

3. Name it my_blog and click Create

Now that we have a database we can proceed to set up the application to work with the database.

1. Open your file explorer and navigate to my-blog folder

2. Open the .env file in your code editor

3. Change the following in the file:-

APP_NAME key to name of your blog i.e. “My Blog”

DB_DATABASE key to database name i.e. my_blog

The final file should look like this:

...

APP_NAME="My Blog"

...

DB_CONNECTION=mysql

DB_HOST=127.0.0.1

DB_PORT=3306

DB_DATABASE=my_blog

DB_USERNAME=root

DB_PASSWORD=

...

With everything configured it’s time to run our app and see what it looks like.

To run the application, type the following command:

php artisan serve

It will start the application and give you a URL, http://localhost:8000, open the URL in your browser and see the application (shown below).

I hope it can help you...


Recommended Posts