You are currently viewing Part 1: Building A Blog Application Using Laravel 5. 7 and Php 7.2

Part 1: Building A Blog Application Using Laravel 5. 7 and Php 7.2

Welcome to the first section of this tutorial series, building a blog application. In the course of this tutorial series, we will be learning the following:

  1.  Registering and login users.
  2. Admin control panel to manage posts and users.
  3. Uploading Image.
  4. User commenting on posts.

Assumption

Laravel 5.7 has a few system requirements and in this tutorial we are assuming that you have already setup the development environment on your machine. Laravel recommends using Laravel Homestead, but you can also use other development environment such as wamp server, Mamp server or Xampp Server. To learn more about Laravel 5.7 system requirements visits Laravel 5.7

NB: In this tutorial, I will be using Linux Operating System.

Let’s get Started!

We are going to start by setting up a new laravel 5.7 project, I have navigated to a folder on my desktop and opened a terminal window. To create a new laravel project, I am going to use Composer and this make it easy to create a new Laravel project. On my terminal window, I am going to run the following command:

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

This will download the laravel framework and setup a folder called blog for our project. Here is a sample out put of my terminal.

The image shows how the laravel installation process take place. Now, to the interesting questions, how do we run this project? Which options do you have to run laravel application? Laravel ships with a very powerful development server and in this tutorial, I choose to use this development server. To see whether our application installed correctly, I will navigate to our blog folder on my terminal and run the following command

php artisan serve

Here is the output of my terminal:

From my terminal, laravel shows that the development has started at :http://127.0.0.1:8000/ On my browser, I will navigate to that url and here is the output on my browser:

Laravel Folder Structure

The default laravel folder structure provide a good starting point for small and large projects. Here is screen shot of the folder structure of our blog project.

In the above laravel folder and file structure, I want to go through some of them.

  • .env – In this file you can provide basic configuration for your project. This includes but not limited to database connection, email configuration etc.

  • artisan – Every time we use artisan command on the terminal, this file loads the necessary commands.

  • app – This folder contains the core code of laravel application.

  • bootstrap – This folder contains app.php file which bootstrap the laravel application.

  • config – This folder contains configuration files for your laravel application.

  • database – This folder contains all files and configuration related to database management.

  • public – This folder contains index.php file which is the entry point to your application and files such as css and JavaScripts.

  • resources – this folder contains Laravel views and un-compiled assets(LESS).

  • routes – This folder contains all url definitions for your application.

  • storage – This folder contains all compiled items such as views, sessions, cache etc.

  • tests – This folder contains your automated unit tests.

  • vendor – This folder contains Laravel framework dependencies.

Learn more about laravel folder structure

Goals achieved in this lesson

1. We have learnt how to create a new Laravel project using composer.

2. We have learnt how to run a development server.

3. We have learnt about Laravel folder structure.

NB: Have a look at Laravel MVC

Question: How do you setup your Laravel development environment?

In the next lesson, we will start building our blog application, step by step together with you and this lesson has given us a great starting point. See you in Lesson II.

 

Facebook Comments