in Programming

Getting Started with Laravel 5.0 as Simple as Possible

The last post I wrote about is all about frameworks and how they are useful if you are planning on building large scale applications without having to worry about messy code. But, practicing from scratch is a great way to get the feel and look how the PHP language works. If you already mastered PHP and have a good experience with OOP, then frameworks will be your next best friend.

Getting Started

There are many excellent PHP frameworks that you can find in the web. And some of these includes the ever reliable CodeIgniter,  Yii, Cake PHP, Laravel, etc. While choosing the right framework is a daunting task, but everyone has its own choice and appeal. Laravel is just one of the many frameworks that are built in PHP and it is by far one of the best there is on its class.

Laravel has a beautiful, semantic and syntax that will definitely perk the inner programmer in you.

Installing Composer

First of all, Laravel utilizes Composer to manage all of its dependencies. So before you can start programming you need to make sure that you have Composer installed in your system.

Composer is a dependency manager for PHP. Which means it will allow you to import other libraries to your project and it will do it all for you. Think of it as a helper. Instead of manually copy and pasting a new bootstrap update to your old bootstrap folder in your project. Composer magically does it for you with the use of the command line.

Start by downloading Composer and installing it in your system. This is for Windows version.

composer_ini1

At some point of the installation, Composer will require you to locate your php.exe. In this example, if you are running Xampp, you can navigate your way through <driveletter>:\xampp\php\php.exe.

composer_ini2

Installing Laravel

Navigate to the path where you want Laravel to be installed. In this case, if you have xampp running in drive C and want to create the Laravel folder inside htdocs. Open first a command line and path your way to C:/xampp/htdocs. To make sure that Composer is running. Try running this code.

This command will let you know if PHP was successfully installed in your system. If you are successful you will receive some information like the PHP version and other information.

Once everything is up and ready, it’s time to install Laravel 5 using Composer. Let’s start by familiarizing some basic Composer syntax. There are a bunch of Composer commands that you can try but we will start with the basic. Always remember that when running Composer commands you need to understand it will always begin with the word “composer” followed by the command. We’ll discuss more on a separate tutorial with other Composer commands. You’ll be surprised on how useful it is.

Let’s try with the create-project command. Input this following command in your command line.

Input your desired name for the project name and press enter. At this point, you will see how composer manages to download all of Laravel neat little package into your workspace. Downloading the raw code from the internet and manually pasting it to your workspace will be a thing of the past. Actually, it is cloning a repository, checking out and placing it on your local computer. All thanks to the power of Composer.

composer_laravel
At this point, you will notice that your CLI is downloading a bunch of stuff. Wait for it to finish. These include the Core Laravel files and other repositories. Once it’s done, you now have successfully installed Laravel in your system. Open a browser, and try this address.

You should be able to see this beautiful landing page. Congratulations! you have successfully installed Laravel 5. we’ll continue more in the next part.

laravel5

  • acbadz

    This is how you make a tutorial for noobs, very specific and sequential. Would be more helpful if installation links are provided, but meh, you can always google it. Cheers! Will be waiting for the continuation. 😀