What is Laravel
Laravel is a framework for building web applications in PHP. It handles the routine parts — routing, database access, authentication, templates — and gives the project a clear structure. You are left to write the code that is specific to your site.
What you need
You need PHP 8.2 or newer and Composer — the PHP package manager. Check in the terminal that they are installed:
php -v
composer -VCreating a project
A project is created with Composer:
composer create-project laravel/laravel blog
cd blog
php artisan serveThe php artisan serve command starts the built-in development server. The site opens at http://localhost:8000.
Project structure
| Folder | What is inside |
|---|---|
app/ | Application code: models, controllers |
routes/ | Routes |
resources/views/ | Page templates |
database/ | Migrations and seeders |
public/ | Entry point and static files |
config/ | Framework settings |
The path of a request
Every request follows the same path:
- The browser requests an address, for example
/posts. - Laravel finds the route for that address.
- The route calls a controller method.
- The controller gets data from a model and passes it to a template.
- The finished HTML page goes back to the browser.
Each step has its own lesson in this course.
Settings
Settings that differ between your computer and the server live in the .env file in the project root: the site name, debug mode, database access.
APP_NAME=Blog
APP_DEBUG=trueArtisan
artisan is Laravel's command-line helper. It creates files, runs migrations and clears the cache:
php artisan list
php artisan make:controller PostControllerThe first command lists every command, the second creates a controller.
Common mistake
The .env file holds passwords and keys, so it must not be added to Git — it is already listed in .gitignore. On the server this file is created separately. Be sure to set APP_DEBUG=false there: in debug mode the error page shows visitors the project's code and settings.