Welcome to the first blog post under Laravel learning notes.

I am Kapil Sharma, Technical Architect at Eastern Enterprise and working on web technologies since last 10 years. You can find more about me on my personal website kapilsharma.info or contact me through twitter @kapilsharmainfo or contact us from on website.

I am publishing my notes I made for personal reference while learning laravel. Although I do not include very basics of language in my personal notes but since I’m publishing these notes, I’ll add some more basics here for those trying to learn laravel using my notes.

Prerequisite

In these notes, I’m going to cover all the basics of laravel but I do expect readers have moderate to good understanding of PHP. Knowing any other MVC framework is not essential but good to have as I’m not going to cover basics of MVC design pattern. If you don’t know or understand MVC, just google it a bit.

Installation

First step while learning anything new is to install the tool, in our case, laravel. We will install laravel through composer. Using laravel (or probably any other PHP project) using homestead or custom vagrant box is recommended in professional development environment but that is currently out of scope for this post.

We mostly use composer to install laravel. Composer is the dependency management tool for PHP. Dependency management tool basically read a configuration file to identify all the project dependencies and install them. Assuming you do not have composer installed, lets first install composer.

Installing Composer (Windows)

Installing composer on windows is as easy is installing any other program. Simply go to https://getcomposer.org/download/ and download windows installer. Downloaded file name must be similar to Composer-Setup.exe. Once downloaded, double click it and follow onscreen instructions like any other program.

Now open a command window and type ‘composer’. It must display composer options which also indicate composer is successfully installed.

Installing Composer (Linux)

On linux, best way to install composer is through Curl. Run the following command

curl -sS https://getcomposer.org/installer | php

However you may wish to move your composer files to bin directory so that you can run it from anywhere. Run following command to move it to bin.

curl -sS https://getcomposer.org/installer | php

Now we have composer installed. In next section, I’ll cover all the composer commands we will need but learning composer is out of scope of these notes. If you want to know more about composer and its commands/options, visit getcomposer.org.

Installing Laravel

Now we have composer installed so we can use it to install laravel. Open console and go to the path where you want to install laravel, this could be www directory of your WAMP/XAMPP or your projects directory (assuming you set virtual host there).

In console, type following command to install laravel.

composer create-project laravel/laravel Laravel-learning

In the above command, ‘composer’ is obviously name of composer program. By this, we are instructing operating system to run composer.

‘create-project’ is composer option which tell composer that we want to create new project.

‘laravel/laravel is the identifier of laravel. By this, we tell composer that we want to create laravel project.

‘Laravel-learning’ is optional name of folder to be created. If we skip that, folder ‘laravel’ will be created.

Above command will install laravel. After installation, newly created ‘Laravel-learning’ folder will have four folders (app, bootstrap, public, vendor) and few files. Opening index.php file in public folder will display first laravel page.

In the next post, we will understand routes and views. We will create views using simple HMTL/PHP pages and also check the basics of blade template engine.