Lesson One: Introduction to Laravel
Laravel is an open source framework built in PHP, used for developing modern web applications.
Learn Laravel 11
February 10, 2025

Lesson One: Introduction to Laravel
What is Laravel?
Laravel is an open-source PHP framework used for developing modern web applications. It is known for its ease of use, high performance, and strong community support. Laravel provides many features that simplify the application development process, such as:
- Routing System .
- Database and Relationships (Eloquent ORM) .
- Authentication System .
- Template Engine (Blade Templating Engine) .
- Tools for managing background jobs (Queues, Jobs) .
Why Laravel?
- Ease of Learning : Laravel offers a clear and easy-to-understand structure.
- Large Community : There are plenty of resources and documentation available.
- Flexibility : You can build any type of web application using Laravel.
- Ready-Made Tools : Provides tools like Artisan CLI, which makes it easier to perform common tasks.
Prerequisites
Before starting to learn Laravel, you need a basic understanding of the following:
- PHP : You should have a good knowledge of the PHP language.
- MySQL or other databases : You need to understand how to work with databases.
- HTML/CSS/JavaScript : For building user interfaces.
- Composer : A PHP package management tool.
Setting Up the Local Environment
To start working with Laravel, you need to set up a local development environment. Here are the detailed steps:
1. Installing PHP
PHP is the core language on which Laravel runs. Therefore, you need to have PHP installed on your machine.
On Windows:
- Go to the official PHP website: https://windows.php.net/download/ .
- Download the version suitable for your system (64-bit or 32-bit). It's recommended to choose the latest version (like PHP 8.x).
- After downloading, extract the files to a folder on your machine (e.g.,
C:\php
). - Add the PHP path to your Environment Variables :
- Open "Control Panel" → "System" → "Advanced system settings".
- Click on "Environment Variables".
- Under "System variables", find "Path" and click "Edit".
- Add the path where you extracted PHP (e.g.,
C:\php
) and press "OK".
- To verify that PHP is working, open Terminal (Command Prompt) and type:
php -v
On macOS: macOS usually comes with PHP pre-installed. To check:
php -v
If it’s not installed, you can install it using Homebrew:
On Linux (Ubuntu): You can install PHP using the following commands:
To verify the installation:
2. Installing Composer
Composer is a PHP package manager used to install and manage Laravel. Without Composer, you cannot use Laravel.
On Windows:
- Go to the official Composer website: https://getcomposer.org/download/ .
- Download the installer for Windows (
Composer-Setup.exe
). - Install it normally.
- To verify that Composer is working, open Terminal and type:
On macOS/Linux: You can install Composer using the following commands:
To verify the installation:
3. Installing XAMPP or Laragon
XAMPP and Laragon are two popular options for setting up a local PHP environment. You can use either one.
XAMPP:
- Go to the official XAMPP website: https://www.apachefriends.org/index.html .
- Download and install XAMPP.
- After installation, open the XAMPP control panel and start Apache and MySQL .
Laragon:
- Go to the official Laragon website: https://laragon.org/ .
- Download and install Laragon.
- After installation, open Laragon and start Apache and MySQL .
4. Installing Laravel
After installing Composer, you can install Laravel using the following command in the Terminal (Command Prompt):
5. Creating a New Project
To create a new Laravel project, use the following command:
This command will create a new folder named my-first-laravel-app
containing the basic project structure.
6. Running the Local Server
Navigate to the project folder using the Terminal:
Then, run the local server using the following command:
A message will appear indicating that the server is running at http://127.0.0.1:8000
. Open this link in your browser to see the default Laravel page.
Laravel Project Structure
When you open a Laravel project, you'll find several folders and files. The most important ones are:
- app/ : Contains models, controllers, and more.
- routes/ : Contains route files.
- resources/ : Contains views and other frontend-related files.
- public/ : Contains public files like CSS and JavaScript.
- config/ : Contains configuration files.
Writing Your First Route
Let’s start by writing our first "Route" in Laravel. Open the routes/web.php
file and add the following code:
This code will display the message "Welcome to Laravel!" when you visit the homepage (/
).
Routes in Laravel
Routes are Laravel's way of handling HTTP requests. We can define routes using functions like Route::get()
or Route::post()
, etc.
Another Example:
When you visit http://127.0.0.1:8000/about
, the message "This is the about page." will appear.
Artisan CLI
Artisan is Laravel's command-line tool. You can use it to create files, run migrations, and more. For example:
- To create a new controller:
php artisan make:controller MyController
- To create a new model:
php artisan make:model Post
Conclusion
In this lesson, we learned:
- What Laravel is and why it is a great choice for web application development.
- How to download PHP and Composer and set up the local environment using XAMPP or Laragon.
- How to install Laravel and create a new project.
- Writing your first Route and understanding the project structure.
If you're ready to continue, we can move on to the second lesson where we’ll discuss Controllers , Views , and how to build web pages using Laravel!
Comments

There are no comments
Please login to leave a review