Important Terminology

Updated on Jul 11, 2024

It is time to discuss some vital terms and concepts that anyone looking to work with Laravel and PHP must know. Knowing what each of these things does will make using Laravel much easier and eliminate guesswork. Not only that, but some of these terms are at the core of Laravel and PHP functionality, so understanding them is nearly imperative. 

Below, you will find a collection of terms and concepts that we think are most vital to understanding and using Laravel.

Argument

An argument is a way to provide more information to a function. The function can then use that information as it runs, like a variable. To put it differently, when you create a function, you can pass in data in the form of an argument. Only that specific function will use its assigned arguments.

Backend

The backend of a web application is where its code is contained and executed. It is usually not the part a user sees and interacts with. It is one of two layers which make up a web application. The other layer is the frontend. The backend also contains all the logic needed to execute the code and the necessary tools or other software.

Bootstrapping

Bootstrapping in the context of Laravel is the process of combining all of the application's elements to begin executing its functions. It is not just the process of actually launching the application but also the process that occurs every time a request is made to it. For instance, when a web page is requested, that triggers the bootstrapping process, which then activates all the necessary components of the application to produce a response to the request.

Callback

A callback is any reference to executable code passed as an argument to another piece of code; that code is expected to call back (execute) the callback function as part of its job. This execution may be immediate, as in a synchronous callback, or it might happen later, as in an asynchronous callback.

Container

Containers are packages of software that contain within themselves all the necessary elements to run in any environment. In this way, containers virtualize the operating system and run anywhere. Not only that, but they also optimize the development process since changes can be made to a specific container without affecting the rest of the application's code.

Class

In object-oriented programming, which Laravel is based on, a class is a template definition of the methods and variables in a particular kind of object. In other words, it is a blueprint for an object. Thus, an object is a specific class instance containing real values instead of variables. A class can have subclasses that can inherit all or some of the characteristics of the Class. In relation to each subclass, the Class becomes the superclass. Subclasses can also define their own methods and variables that are not part of their superclass. Classes typically rely on dependencies (other classes or objects) to perform their functions. Finally, the structure of a class and its subclasses is called the class hierarchy.

Controller

We already mentioned what Controllers are in a previous section of our tutorial. Still, they are a significant part of Laravel's functionality, so they should also be on this list. We will also elaborate on them a bit further. Firstly, controllers are where an application's logic is contained. They are PHP classes that handle incoming HTTP requests and manage the application's response to those requests. Controllers contain methods that define the actions that can be taken on a resource, such as creating, reading, updating, and deleting data. They are the highway between the View (interface) and the Model (database).

CRUD

CRUD stands for "Create, Read, Update and Delete." Those are the four most basic functions models can perform in Laravel, and it is a paradigm at the base of many web applications.

Dependency

Dependencies are packages or third-party modules/plugins required for your project to run. Imagine plugins for WordPress. Dependencies can add functionalities to your application or support other application functions.

Expression

In programming, an expression is a value or anything that executes and ultimately becomes a value. Another way to explain this is that the purpose of an expression is to create a value.

Facade

A Facade in Laravel is a class that provides a static interface to services inside a container. In other words, it is a class wrapping a complex library to provide a more readable interface for it.

Function

A function in Laravel and PHP is a piece of code written to perform a specific task. They take a data parameter, run it through a block of statements, perform a necessary operation, and then return a value as the result. PHP has thousands of built-in functions and can be used over and over. For instance, a function can display text on a web page when the page is accessed. Or, it can kill a process when a specific parameter is met.

Frontend

The frontend of a web application contains all the software or tools needed for a user to interact with said application. The frontend is more commonly known as the user interface: the appearance and interactable objects of an application. 

Handler

A Handler, or a PHP Handler, is a piece of code that tells the hosting server (Apache most commonly) how to process certain PHP scripts. Without such Handlers, the server will simply send the user to the PHP script's file and start a download since it doesn't know what else to do. A Handler is the interface between a web server and PHP.

Illuminate

Illuminate is just the word Laravel developers chose to describe all of the packaged services it provides. In Laravel's context, the word means everything the framework comes with. The Illuminate directory in an application contains all of the Laravel services.

Kernel

In the context of Laravel, a Kernel is a central component of the web application's functionality. It handles console commands and HTTP requests and directs them to the appropriate Middleware or routes. Because of that, Laravel has two Kernels: HTTP and Console. Whenever a request is received on the proper channel, the specific Kernel activates and directs the request.

Mailer

A Mailer is a piece of software or a block of code that is responsible for sending out emails. In Laravel, it is powered by the Symfony Mailer. A mailer is responsible not just for sending emails, but for providing methods to define sending parameters (recipient, subject, content, etc.) as well.

Middleware

When your application receives a request, it typically evokes a response. However, Middleware can be placed between those two actions to alter the chain of events depending on specific parameters. For instance, Laravel has Middleware that can check if a user is authenticated before allowing them to access a web page. If not, the Middleware will direct them to the login page. Middleware is used like this to add specific behavior to the request-response cycle.

Migrations

The name is a bit misleading, but a Migration is a process that allows you to insert a table in your application's database without actually going to the database management interface (phpMyAdmin, for instance). It is a convenient way of manipulating your database without actually breaking any records within it.

Model

Another vital component of Laravel's functionality, the Model interacts with and fetches data from the application's database. Essentially, a Model is a type of Class tasked with interacting with the database with the help of the Eloquent ORM. Eloquent helps by assigning a Model for each database table, allowing a more straightforward way of working with the tables. We discussed Eloquent earlier in our tutorial and how it uses the Artisan CLI to facilitate the interaction with database models.

Namespaces

The easiest way to explain Namespaces is to equate them to directories in a file system. In a way, Namespaces are, in fact, directories within your application as they point to the files with your application's code. Namespaces split up your code into different areas (directories) for easier management. The use keyword can be used to import a namespace into a file. That way, you don't have to write the full path to it every time you use it.

Object

Above, we mentioned how a class is a blueprint for objects: it defines their properties and functions. An object is an instance of the Class, but instead of mere definitions, it contains tangible, interactable data and behavior. That allows for a more structured and modular code, which, as mentioned in this tutorial, makes developing more straightforward. A simple example would be Eloquent's models for interacting with the database. When retrieving data from the database using one such model, the response is an object that can be worked with.

Package

Packages are the primary way developers can add functionality to their web applications. There is almost no limit to the functionality that can be added, as each package is created for a specific purpose. Packages must be placed in the composer.json file and installed via Composer. Then, simply run the composer install command, and the software will handle the rest. Additionally, packages can be individually installed with Composer as well by using this command, replacing the vendor and package name, and version with the specific details of the package itself: composer require <vendor_name>/<package_name>:<version>

Request and Response

Requests and Responses are fundamental when it comes to handling HTTP communication within the web application. In short, a Request represents an incoming HTTP request, while a Response represents the application's output related to that HTTP request. For instance, when a user opens an image, the browser sends a Request to the application, which returns a Response with the image. That is an overly simplified example, but it portrays the interaction between the browser and the application. 

Routing

Routing involves mapping all application requests and demands to the appropriate controllers. Creating routes. These routes map a specific request to a particular URL within the application. They are contained in the Routes/web.php file for routes or the Routes/api.php file for APIs. When a particular route is invoked, typically by accessing a URL in a browser, the Laravel application checks the necessary files and displays the matching content. The browser displays an error message if no content matches the invoked route. Simply put, routes tell the application what to do when specific URLs are requested.

Service Container

Service Containers are one of the most fundamental and essential parts of Laravel. They are used for managing class dependencies and performing dependency injections. As classes can depend on other classes or objects per their functions, a Service Container allows users to inject those requirements without relying on the application itself to create them for itself. In other words, you, as the user, can provide the classes within the Service Container with the necessary dependencies—a way of organizing and resolving dependencies more efficiently.

Service Providers

Without Service Providers, your application's bootstrapping process would likely be much more chaotic as it is trying to find all of its necessary components. Instead, Service Providers organize the process by registering a particular service to its service container. That not only promotes modularity, but it also streamlines the bootstrapping process since Laravel now knows where that particular service is. Laravel itself comes with several service providers for different services, such as configuration settings, database connections, etc.

Statement

Statements are the building blocks of applications. They are units of code that perform a specific task. They are the steps the application must follow to achieve the user's end goal. Typically, Statements can assign values to variables, declare functions, execute different code based on a condition, etc. Every application is made up of a chain of Statements that are executed in order, which then defines the behavior of said application.

Template

When it comes to programming, Templates are blueprints for creating an application's components. They are a starting point for making content, which can be modified and filled in according to the user's requirements. Templates are extremely useful when creating multiple pieces of content, as most of the code is already written and only requires modifications.

Variable

In Laravel and programming in general, a Variable is an identifier for a value. It is used to store and manipulate data within an application. Said otherwise, a Variable is a named container used to store data, which it then passes to other parts of the application: Controllers, Views, Models, etc.

View

Views are the visual representation of your application: the interface, the interactable objects, etc. Typically built with HTML and CSS, Views represents the presentation logic instead of the application (business) logic. Views in Laravel are normally handled by the Blade Templates service that Laravel comes with. Being Blade Templates, Views are not static but contain the most necessary code, with placeholders for dynamic items. The dynamic content is rendered when a View is requested, and the user sees it in their browser. Views are stored in the resources/views directory of the Laravel project. By default, Laravel comes with a set of predefined views, such as welcome.blade.php and errors/404.blade.php.

On this page...