A Step-by-Step Guide to Getting Started With Laravel Framework

A Step-by-Step Guide to Getting Started With Laravel 13 Framework

Laravel remains the most widely used PHP framework for building web applications, APIs, and increasingly AI-powered products, thanks to its Laravel AI SDK. If you’re evaluating Laravel framework development for a project or just want to understand how it works before you brief a development team, this guide walks through the full MVC request cycle from installing Laravel to rendering your first page using the current Laravel 13 release.

Laravel is a PHP web framework built on the MVC (Model-View-Controller) pattern. To get started: install PHP 8.3+ and Composer, run laravel new your-app, then build out a Model, Migration, Controller, Route, and Blade View for each resource in your application.

What You Need Before You Start

  • PHP 8.3 or higher (Laravel 13’s minimum requirement)
  • Composer (PHP’s dependency manager)
  • A database โ€” MySQL, PostgreSQL, or SQLite (SQLite ships as the zero-config default for new projects)
  • The Laravel installer: composer global require laravel/installer

How Laravel’s MVC Pattern Works

Laravel is built on MVC architecture, which separates an application into three responsibilities:

  • Models: talk to the database and represent your data as PHP objects (Eloquent ORM).
  • Views: the Blade templates that render HTML back to the user.
  • Controllers: sit in between; they receive requests, ask a model for data, and hand that data to a view.
  • Routes: map an incoming URL to the controller action that should handle it.

The Request Lifecycle

  1. Request: a user hits a URL in your app.
  2. Route: routes/web.php matches that URL to a controller action.
  3. Controller: the action asks the relevant Model for data, then passes it to a View.
  4. View: Blade renders the final HTML response.

Step 1: Install Laravel

bash

composer global require laravel/installer
laravel new blog-app
cd blog-app
php artisan serve

The installer will prompt you to choose a starter kit (React, Vue, Livewire, or API-only), a testing framework (Pest is the default suggestion in 13.x), and a database. Since Laravel 11, the application skeleton is intentionally minimal. There’s no separate Kernel.php anymore; middleware, routing, and exception handling are all configured in bootstrap/app.php.

Step 2: Create a Model and Migration

Use Artisan, Laravel’s built-in CLI, to scaffold a model with a migration in one command:

bash

php artisan make:model Post --migration

This generates app/Models/Post.php and a migration file under database/migrations/. In Laravel 13 you can define table configuration either the traditional way or with the newer attribute syntax:

php

// Traditional property syntax (still fully supported)
class Post extends Model
{
    protected $table = 'posts';
    protected $fillable = ['title', 'body', 'published_at'];
}

php

// New in Laravel 13: attribute syntax
#[Table('posts')]
class Post extends Model
{
    protected $fillable = ['title', 'body', 'published_at'];
}

Then define your table columns in the migration and run it:

php

Schema::create('posts', function (Blueprint $table) {
    $table->id();
    $table->string('title');
    $table->text('body');
    $table->timestamp('published_at')->nullable();
    $table->timestamps();
});

bash

php artisan migrate

Step 3: Create a Resource Controller

Laravel treats a data type like Post as a resource, with a controller that handles the standard CRUD actions (index, create, store, show, edit, update, destroy):

bash

php artisan make:controller PostController --resource --model=Post

Using --model=Post also type-hints the model into each method automatically via route model binding, so you skip manual Post::find($id) lookups in most cases.

Step 4: Register Routes

In routes/web.php:

php

use App\Http\Controllers\PostController;

Route::resource('posts', PostController::class);

That single line generates all seven RESTful routes:

MethodURIActionRoute Name
GET/postsindexposts.index
GET/posts/createcreateposts.create
POST/postsstoreposts.store
GET/posts/{post}showposts.show
GET/posts/{post}/editeditposts.edit
PUT/PATCH/posts/{post}updateposts.update
DELETE/posts/{post}destroyposts.destroy

Step 5: Build the Show Action

With route model binding, the controller method receives the already-resolved model, so no manual lookup is required:

php

public function show(Post $post)
{
    return view('posts.show', compact('post'));
}

Step 6: Build the Blade View

Create resources/views/posts/show.blade.php:

blade

<!DOCTYPE html>
<html>
<head>
    <title>{{ $post->title }}</title>
</head>
<body>
    <h1>{{ $post->title }}</h1>
    <p>{{ $post->body }}</p>
    <small>Published: {{ $post->published_at?->format('M d, Y') }}</small>
</body>
</html>

Blade’s {{ }} syntax auto-escapes output for you, compiling down to <?php echo e($post->title); ?> behind the scenes, which protects you from XSS by default.

Step 7: Test It

Laravel 13 defaults new projects to Pest for testing. A quick feature test for the route above:

php

it('shows a single post', function () {
    $post = Post::factory()->create();

    $this->get(route('posts.show', $post))
        ->assertOk()
        ->assertSee($post->title);
});

bash

php artisan test

Frequently Asked Questions

Is Laravel still relevant in 2026? Yes. Laravel 13 is under active development with a stable release cadence, a production-ready AI SDK, and one of the largest PHP job markets and package ecosystems (Packagist/Composer) of any framework.

What PHP version does Laravel need in 2026? Laravel 13 requires PHP 8.3 or later. Laravel 12 (PHP 8.2 minimum) continues to receive security fixes until February 2027 if you’re maintaining an existing app.

Do I need to know PHP before learning Laravel? Yes. Laravel is a PHP framework, so a working knowledge of PHP fundamentals (OOP, namespaces, Composer) will make this guide much easier to follow.

What’s the difference between Laravel and plain PHP? Laravel provides routing, an ORM (Eloquent), templating (Blade), authentication, queues, and testing tooling out of the box, replacing hundreds of hours of boilerplate you’d otherwise write by hand in plain PHP.

Should I hire a Laravel developer or build it myself? For a learning project or small internal tool, this guide is enough to get moving. For production applications with security, scaling, or timeline requirements, working with an experienced Laravel development team is usually faster and safer.

Final Thoughts

The MVC flow hasn’t fundamentally changed since Laravel’s early versions. Model, Migration, Controller, Route, View is still the backbone of every Laravel app. What has changed is the tooling around it: PHP 8.3, a leaner skeleton, attribute-based configuration, and first-party AI and testing tooling. If you’d rather have this built for you than build it yourself, talk to our Laravel development team about your project.

Request A Free Quote

This field is for validation purposes and should be left unchanged.