Laravel Beginners Session With MySQL and MongoDB

Laravel Beginners Session

Introduction

Hi this is my first post. I am going to talk about Laravel. In this multi part series I am going to develop an application for myself. You can follow along to get started.

Who am I?

I am professional Web developer and Blogger. I have different blogs and websites in Laravel. Some are live some are in development. When I get free time I do WordPress stuff.  I watch movies a lot. Enough talking about me. Lets get back to work.

What are we going to do?

In this post I am going to take you through all the steps to setup a Laravel application with MySQL as well as MongoDB. If you have any questions, feel free to post on comments or ask on my Facebook page. I will try to reply as much possible.

What is Laravel?

Before getting into coding, lets talk a bit about what is Laravel. Laravel is a PHP framework and most popular one at present. It’s based on MVC design pattern. It have many inbuilt functionality out of the box that keeps you away from re-inventing the wheel.

Lets Start

Time to do coding stuff. I am going to write all commands for Linux Ubuntu 16.04 as I am using same right now. If you don’t have one you can do on any platform it will be working with same commands on Windows, Linux and Mac. So, it really doesn’t matter, feel free to do it.

Installation

Go to composer, and download and install composer if you don’t have it on your system. If you find it tough to install composer, you can follow this awesome digital ocean guide.
Install Laravel by using composer in your web directory of Ubuntu, which is by default /var/www/html/. Run following command to install Laravel.

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

Here blog is project name. Change it to whatever you like. If you get permission error you should run this command as sudo. It will take a while and will download all the dependencies and files for Laravel. Once it’s done, change directory to the project directory

$ cd blog

Now you can run your application by typing:

$ php artisan serv

This will run your Laravel application. You can see it running in your browser by typing at http://localhost:8000

Congratulations! You have done the first step and you have a full Laravel application running on your system. In my next post I shall be talking about database connection with MySQL and MongoDB. Keep visiting. If you have questions, use below comment section.

If you like this post, do share it with your friends and team.