Laravel — An Introduction


Welcome, dear friends!

Today, we going to learn about this wonderful tool called as Laravel.
But, what is Laravel? What are the systems requirements to use it? How I install? What knowledges need I have to work with it?

So let answer all these questions here!

First of all… What is Laravel?

Laravel is a framework made in PHP that will make easy your web development, at the moment of this post, Laravel was in your 5.4 version. Maybe this mean should generate another doubt… What is a framework? So, a framework is a kind of library that group a lot of specific functions in one project, however the difference between framework and library are that a framework is the one that controls the flux of our application. It’s called as Inversion of control. The Laravel have a structure of folders and files based on MVC model and an intern engine called as Blade.

A little bit more about Blade: Blade is the simple, yet powerful templating engine provided with Laravel. Unlike other popular PHP templating engines, Blade doesn’t restrict you from using plain PHP code in your views. In fact, all Blade views are compiled into plain PHP code and cached until they’re modified, meaning Blade adds essentially zero overhead to your application. Blade view files that have this extension: ‘.blade.php’ file and it are typically stored in the ‘resources/view’ directory.

So that was a little introduction of Laravel. We’ll learn much more on the practice, because where are the funny of just read about it?! We’re developers! Let’s play with it with our codes!

System Requirements:

To use Laravel, you’ll need have installed on your machine the Composer, because it uses it to manage his dependencies.
You can download it for windows on http://getcomposer.org and get a tutorial to install on mac and Linux too. If you are not using a Laravel Homestead virtual machine, make sure you have these items on your machine:

  • PHP >= 5.6.4
  • OpenSSL PHP Extension
  • PDO PHP Extension
  • Mbstring PHP Extension
  • Tokenizer PHP Extension
  • XML PHP

How to install:

As I said before Laravel utilises Composer to manage its dependencies, so to get the laravel installer, we’ll need run this command in our prompt: composer global require “laravel/installer”

View:

After done, you’ll have Laravel installed on your machine.

Now it’s time to starts a new project. We have two ways of doing it:

  • First: running this line command: laravel new name_of_projectb
  • Second: running this line command: composer create-project — prefer-dist laravel/laravel name_of_project

Be attempt for one thing: wich directory you are in! In my example, first I changed the directory to my C folder, and inside it, I created another folder called Laravel and called my new project as Project. Independent of wich command you choose, It’ll create the same file tree, and at the end of the process of creation you will get this:

Now if you go to this directory on your PC, you’ll see all files and folders that were created.

In another moment we’ll see all these folders and files and what they do.

To edit anything you want, you can use any text editor. I like to use Sublime Text 3 because it has some plugins that are very useful for Laravel, but feel free to use what you want!

At last but not least… What knowledges need I have to work with Laravel?

How I said at the beginning, Laravel is based on PHP language, so you need now about how to program in PHP and knows about Object Orientation. Its fundamental know about how works databases in MySql. And at last, knows about HTML and CSS as markup languages. This collection of languages will turn you into a great web developer and believe, you’ll be a great developer!

That’s all Folks! I hope that I had shown to you a little bit of how is wonderful works with Laravel. On my next post, I’ll show more things about his structure and starts some features about Authentication System!

“Changing the way of programming to web”, Rodrigo Rodrigues