Todo Laravel Project - Getting Started

Laravel Project

Next →

In this Laravel project we will learn to create a simple Todo application.

Prerequisite

It is assumed that you have some basic knowledge of the following.

It is also assumed that you have the following installed on your development computer.

  • PHP >= 7.1.3
  • MySQL database
  • Composer

IDE or Text Editor

Feel free to use your favourite IDE or text editor for PHP.

Here are some of the IDEs that you can use for Laravel projects.

  • WebStorm
  • Visual Studio Code
  • Eclipse
  • NetBeans

If you are looking for text editor then consider using Sublime Text.

GitHub

You can find this project code in my GitHub repository todo-laravel. Feel free to check that out.

Alright let's go ahead and create a new Laravel project.

Create a new Laravel project

Open Terminal and run the following command to create a new Laravel project.

$ composer create-project --prefer-dist laravel/laravel todo-laravel

This will create a new project using composer and will name the project as todo-laravel.

Directory permissions

Set writable permission for directories within the storage and the bootstrap/cache directories.

$ chmod -R 755 storage/ bootstrap/cache

Serve using Artisan

To serve project we take help of artisan. Run the following command to see the project output in the browser.

$ php artisan serve

This will start the Laravel development server at http://127.0.0.1:8000.

Open that link and you will get to see the following output.

Create a new database for the project

Now login to your localhost MySQL database and create a new database by the name laravel_todo_db.

Configure .env file

Open the todo-laravel project folder in your favourite text editor or IDE and you will see the .env file inside. Open it and set the database credentials.

Your settings will look similar to the following.

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=laravel_todo_db
DB_USERNAME=root
DB_PASSWORD=root123

Note! The DB_USERNAME and DB_PASSWORD for my localhost MySQL database is root and root123 respectively. Set yours accordingly.

Awesome! Now we have the inital setups done let's move forward and create tables in our new database in the next tutorial.

Thanks for reading. See you in the next tutorial.

Next →