7 things you should know before working on Laravel

Laravel now a days is market standard for web development. Almost every job in PHP community requires experience in Laravel. But learning it sometimes become harder for beginners. Because it offers so many features which might confuse some Laravel beginners.

In this post, I am going to write some of the concept and tool which you should know before starting development in Laravel.

One more thing, Following points are for those who already know the basics of PHP, Database (MYSQL), HTML, CSS and JavaScript. If you don’t know them, Please learn the basics of all of mentioned technologies first.

1) Composer:

Composer is a tool for dependency management on per project basis. It allows you to install libraries your project depends on. It has commands through which you can add, remove or update any package/library. It is available for all OS and you can download it from getcomposer.org.

You don’t need to be a pro of Composer to work on Laravel. You just need some basic understanding to start your project development in Laravel. I already covered composer installation process for windows 10 in one of my previous blog post.

2) Namespace:

Namespace is a way to group code under one umbrella. Purpose of namespace is to solve 2 problems. One is name collision between codes and second it provides alias (shorten) that improve readability of source code. Namespace only works with classes (including abstracts and traits), interfaces, functions and constants and it must be defined at the top of the PHP file.

You will see the use of namespace in almost every Laravel file. I already covered namespace in one of my previous blog post, have a look at Namespace of beginners.

3) Closure:

Closure also calls as Anonymous function, allows making a function without name. It usually use a callback parameter.

4) HTTP Verbs:

Http defines a set of different request methods to specify different action. GET and POST are one of them. There are some other methods as well. Most commonly used are HEAD, DELETE, PUT, PATCH, and OPTION.

You should at least know the basic purpose of all of them. Because Laravel heavily rely on Http verbs in the form of routing.

5) Object Oriented Programming (OOP):

OOP is a programming paradigm that relies on the concept of Classes and Object. There are 4 principles of OOP which are:

  • Encapsulation: It is used to hide the internal representation or state of an object from outside.
  • Abstraction: The purpose of abstraction is to hide unnecessary information from outside.
  • Inheritance: It is the procedure in which one class inherits the attribute and methods of another class.
  • Polymorphism: is the ability of a programming language to present the same interface for several different underlying data types.

You should know the basics of OOP because in Laravel almost every code wraps in classes. Also OOP is very vast topic. You must do practice a lot to digest its concept.

6) Design Patterns:

In Software world, Design Patterns are the best practices for solving reoccurring problems. These are the recommendation of best developers to solve a specific problem. Following are some of the design patterns you should know before start working on Laravel

  • Model View Controller (MVC):

    MVC is an architectural design pattern that separate the application into three layers Model, View, Controller.

    • Model deals with data and its logic. It usually involves database queries
    • View is used for UI part. All of your User interface logic will resides here
    • Controller acts like a middleman for Models and Views. It usually takes the incoming request and involve model to get data and handle data (according to logic) and send to Views.
  • Builder Pattern:

    Builder design pattern allows you to create complex object step by step. This pattern allows you to create different types and representation of an object using the same construction code.

  • Factory Pattern:

    Factory pattern is used to create an object without exposing the creation logic. It is one of the most used design pattern.

  • Facade Pattern:

    This pattern hides the complexities of the system and provides an interface to the client using which the client can access the system.

7) Terminal/Command Prompt:

You must know the basics of terminal/command prompt because Laravel comes with artisan command console. It is a very useful tool to create controller, model, migration and more.

Also Read:


Leave a Reply

Your email address will not be published. Required fields are marked *