Getting Started with LARAVEL ( Chapter 01)

corona image

Coronavirus Impact on eCommerce Industry!

In the previous blog ( Things you need to know about Laravel in 2019) I talked about Laravel and its origin, current and future position in the Web Application/Software development field. This is going to be a small series on Laravel where I will start from the basics and in the end you will have a ready to deploy small CRUD application. As you are following the tutorial I expect you have a basic understanding of Object-Oriented Programming PHP & MySQL. So in this tutorial series, we will follow the official laravel documentation. The documentation will help guide you through if you face any difficulties. So let’s begin.

In this tutorial, we’ll learn the basics of Laravel application installation and running your first Laravel starter application.

Installation:

To start building your first Laravel application you’ll need to install some dependencies first. As the Laravel framework has few requirements So Homestead comes with all the requirements you need to work on your Laravel application. Homestead is an official virtual machine for Laravel. In the next tutorial of this series, I’ll discuss everything you need to know about it. So, for now, will just stick to the most simple one. I am using Ubuntu but You may use any OS you prefer. Because Everything is almost the same. So there’s no need to panic.

As we are not using Homestead for this part of the tutorial, So you need to make sure you have PHP and its extensions installed on your local computer. Therefore I am assuming you have a basic understanding of PHP you should have PHP and its extensions installed on your system.

Now you need to install Composer on your machine. So to install composer just open up your terminal, type in the following command and press enter.

Installing composer:


php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"

php -r "if (hash_file('sha384', 'composer-setup.php') === '48e3236262b34d30969dca3c37281b3b4bbe3221bda826ac6a9a62d6444cdb0dcd0615698a5cbe587c3f0fe57a54d8f5') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;"

php composer-setup.php

php -r "unlink('composer-setup.php');"

After installing composer run the command below to install composer for Laravel globally on your system.

Run composer to check whether the composer is installed properly or not.

Composer Installation check & Composer commands


composer global require laravel/installer

Once you are done installing composer you are ready to create your first Laravel starter application.

To create your first Laravel application run composer create-project --prefer-dist laravel/laravel crud. On this command “crud” is the name of the application. You can type any name you prefer instead of crud. As I prefer to create all my applications inside a folder to keep everything organized, So For me it’s inside the Documents/projects folder. So I will CD into the folder and run the command to create the application.

Creating a new project from composer command

After successfully running the command composer will start setting up a fresh Laravel application in your Documents/projects folder. And it will look like this.

Project files & folders

The next thing we need to do is to generate a unique application id for your Laravel application. To do that first you need to open up your GUI file explorer go inside your folder and copy .env.example to .env . It should look like this.

.env file

Now run php artisan key:generate from CLI tool/ terminal inside your project directory.

Artisan command to generate a key for the application

Now you are ready to run your application. And to do that type and enter php artisan serve from your terminal.

Serving the app on the local machine

And voila! your app is running on this local IP address. On my case which it’s running on http://127.0.0.1:8000 . Now open up your favorite browser and type in the url http://127.0.0.1:8000 .

Congratulations! your application is ready to rock and roll.

And your starter application

This is just a basic laravel application so there’s not much to it. So in the next tutorial, we’ll Install Homestead and discuss how to use homestead with your laravel application. Connecting MySQL database and folder structure of laravel.

Share this post

Taylor Otwell created Laravel mainly for web application development. Laravel provides an amazing experience while developing a web-based application. In order to understand Laravel, we’ll have to understand what PHP is.

PHP

At first, let’s talk about PHP. PHP which stands for Hypertext Preprocessor. PHP was introduced back in 1994 which is one of the most used programming languages over the internet. More than 80% of web applications are developed with PHP because of the combination of PHP & MYSQL. Till now PHP & MYSQL are one of the most rock-solid combinations in the web application development world and this combination is going to stay as rock-solid as it is right now. One of the most used web application Facebook is developed with PHP and now billions of people use it. If you have little bit idea about web applications, you might have heard about WordPress which is one of the most dominating technology for web applications developed using PHP. Learning PHP is a very easy task and it offers a whole lot of detailed documentation that helps the newbies to grasp everything easily. PHP provides all of the functionality that you need to develop a modern web application. To learn more about PHP, visit-https://en.wikipedia.org/wiki/PHP

Laravel

Now let’s talk about Laravel. As we have mentioned earlier that Laravel is a PHP framework. Now you may have a question what is framework? To simply put it, take making noodles as an example. You need to buy raw noodles pack, mix them with other ingredients, boil those things and cook and finally serve. That’s what basic programming language is. On the other hand, the framework is like a 2 minutes’ instant noodles pack, that means all ingredients are ready, all you have to do is just put some boiled water into the cup with some flavors and it’s ready to serve.

Laravel has been in the web application development game for a while now. Many developers all over the globe love it for its outstanding performance & easy to integration technique with other systems. It serves with many features that made this framework so popular over the last few years. Laravel follows MVC architecture which makes one of the most attractive framework to develop web applications. As it’s an open-source platform, there are thousands of contributors who are contributing to making this framework even more powerful. Laravel also comes with many packages which provide hundreds of important functionality to develop applications faster than before.

Current and Future Position of Laravel and PHP

Now let’s talk about its current and future position in the tech world. PHP and its framework are dominating the web world. PHP and frameworks built more than 80% web applications. As it’s getting more & more features and performance improvements in each update, Laravel & PHP will keep on dominating the web world in the upcoming future. Few people think that PHP is a dying language. It’s simply a myth & nothing else. PHP is not going anywhere in the recent future. As we have discussed earlier PHP & MySQL combination which is a rock-solid combination, and no other combination has come closer to this one. Until then there’s no possibility of any language taking the lead.

Should you learn PHP in 2019 and why?

Absolutely yes. There’s no harm in learning PHP right now. If you want to become a web application developer or you want to develop your career in the freelancing world, you can’t ignore PHP & it’s frameworks. Laravel makes it even easier to integrate with other famous front end technologies like VUE js, Node and many more. So If you are passionate about being a web application developer, Laravel is definitely a good choice to start with.

Finally, let me introduce you with a great team “Augnitive” experienced team of passionate engineers working with Laravel and they have been developing an application for the competitive industry for quite a while now. To learn more visit: https://augnitive.com/.

Next Blog on Laravel Tutorial Series: Getting Started with LARAVEL ( Chapter 01)

Share this post

Subscribe to our newsletter