Muhammad Fari Madyan
Hire me
Laravel · part 11 of 11

Upgrading Laravel E-Learning Platform from Laravel 12 to Laravel 13

A complete guide to upgrading the Laravel E-Learning & CBT Platform from Laravel 12 to Laravel 13, covering PHP 8.3, dependency updates, breaking changes, and deployment.

Muhammad Fari Madyan

· 5 min read

Baca dalam Bahasa Indonesia →

Why Upgrade to Laravel 13?

Laravel 13 brings several important improvements:

  • PHP 8.3 Baseline — Faster performance and access to modern PHP features like typed class constants, json_validate(), and the #[Override] attribute.
  • Leaner Core — Removal of redundant polyfills and backward-compatibility code means a lighter, faster framework.
  • Symfony 7.4/8.0 Support — Updated Symfony components provide a more stable and future-proof foundation.
  • New Cache::touch() Method — Extend a cache entry's TTL without re-fetching its value, which cuts unnecessary reads.
  • Improved Queue Consistency — More predictable behavior across different queue drivers (database, Redis, SQS).
  • Better Testing Utilities — Enhanced test isolation with automatic Str factory resets and other improvements.
  • Security Enhancements — Updated encryption primitives and dependency upgrades.

Before You Start

Make sure you have:

  1. PHP 8.3+ installed (this is the big one: Laravel 13 drops PHP 8.2 support)
  2. A database backup (always back up before major upgrades)
  3. A clean Git branch for the upgrade work
BASH
git checkout -b upgrade/laravel-13

Step 1: Update PHP

First, verify your PHP version:

BASH
php -v

If you're still on PHP 8.2, upgrade to 8.3 or later. On macOS with Homebrew:

BASH
brew install [email protected]
brew link [email protected]

On Ubuntu:

BASH
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php8.3 php8.3-cli php8.3-mbstring php8.3-xml php8.3-curl php8.3-mysql php8.3-zip

Step 2: Update Composer Dependencies

The core of the upgrade is updating composer.json. Here are the key changes for our e-learning project:

Framework & First-Party Packages

JSON
{
    "require": {
        "php": "^8.3",
        "laravel/breeze": "^2.3",
        "laravel/framework": "^13.0",
        "laravel/reverb": "^1.8",
        "laravel/tinker": "^3.0",
        "livewire/livewire": "^3.6.4",
        "livewire/volt": "^1.7.0",
        "maatwebsite/excel": "^3.1",
        "spatie/laravel-permission": "^7.2"
    }
}

The key changes are php (^8.2 → ^8.3), laravel/framework (^12.0 → ^13.0), laravel/reverb (^1.7 → ^1.8), and laravel/tinker (^2.10.1 → ^3.0). The dev dependencies stay the same because they're already compatible with Laravel 13.

Dev Dependencies

No changes needed. All packages (phpunit, collision, pint, sail, pail) are compatible with Laravel 13 at their current versions.

JSON
{
    "require-dev": {
        "fakerphp/faker": "^1.23",
        "laravel/pail": "^1.2.2",
        "laravel/pint": "^1.24",
        "laravel/sail": "^1.41",
        "mockery/mockery": "^1.6",
        "nunomaduro/collision": "^8.6",
        "phpunit/phpunit": "^11.5.3"
    }
}

Then run:

BASH
composer update laravel/framework laravel/reverb laravel/tinker -W

💡 Tip: If you encounter dependency conflicts, try composer update --with-all-dependencies to resolve them automatically.

Step 3: Review Configuration Changes

Laravel 13 may change some default configuration values. Compare your config files with the Laravel 13 laravel/laravel skeleton on GitHub. If your app is missing a config file you want to customize, publish it with:

BASH
php artisan config:publish

Key files to review:

  • config/app.php — Check for new default values
  • config/cache.php — New touch method support
  • config/queue.php — Queue driver consistency changes

Step 4: Address Breaking Changes

Removed Polyfills

Laravel 13 removes backward-compatibility code for older PHP versions. If you were using any deprecated helpers, update them now.

PHPUnit

PHPUnit 11 still works for this project on Laravel 13, so you don't need to upgrade it yet. The official upgrade guide recommends phpunit/phpunit ^12.0, so when you move to PHPUnit 12, watch out for:

  • Potentially removed deprecated assertions
  • Stricter method signatures for setUp() and tearDown()

Step 5: Update Frontend Dependencies

No frontend dependency changes are required:

BASH
npm install
npm run build

The existing laravel-vite-plugin (^2.0.0) and Vite (^7.0.7) work fine with Laravel 13.

Step 6: Test Everything

Run the full test suite to catch any issues:

BASH
php artisan test

For our e-learning platform, pay special attention to:

  • Livewire component tests — Ensure all admin, teacher, and student components render correctly
  • Real-time features — Test WebSocket connections with Laravel Reverb
  • Excel import — Verify student import still works with Maatwebsite Excel
  • Role-based access — Confirm Spatie Permission gates still function properly

Step 7: Adopt New Features

Once the upgrade is stable, consider adopting Laravel 13's new features:

Cache::touch()

This is a good fit for our exam session caching: extend the TTL without re-reading the value.

PHP
// In CBT exam: keep the session alive without re-fetching
Cache::touch("exam_session:{$studentId}:{$examId}", now()->addMinutes(30));

PHP 8.3 Features

Take advantage of PHP 8.3 in your codebase:

PHP
// Typed class constants
class ExamStatus
{
    const string PENDING = 'pending';
    const string ACTIVE = 'active';
    const string COMPLETED = 'completed';
}

// json_validate() — No need for json_decode + error check
if (json_validate($submissionData)) {
    // Process the submission
}

Step 8: Deploy to Production

Follow the standard deployment checklist, paying extra attention to the PHP version:

BASH
# Verify production PHP version
php -v  # Must be 8.3+

# Pull and install
git pull origin main
composer install --no-dev --optimize-autoloader
npm install && npm run build

# Migrate and optimize
php artisan migrate --force
php artisan optimize

# Restart background services
sudo supervisorctl restart elearning-worker:*
sudo supervisorctl restart laravel-reverb

Summary

Upgrading from Laravel 12 to Laravel 13 for this e-learning project is relatively straightforward. The biggest prerequisite is making sure PHP 8.3+ is available. The actual code changes are minimal: mostly dependency version bumps, and PHPUnit stays on version 11.

AreaEffort
PHP upgrade🟡 Medium (depends on hosting)
Composer dependencies🟢 Low (only 4 packages changed)
Code changes🟢 Low (minimal breaking changes)
Test fixes🟢 Low (PHPUnit unchanged)
Production deployment🟢 Low

For most projects, you should be able to finish the upgrade in less than a day. Happy upgrading! 🚀


🔗 Resources:

ShareLinkedInXWhatsApp

Written by Muhammad Fari Madyan

Senior Backend Engineer and co-founder of LampungDev. I write up what I build so others can learn from it.

Work with me
← part 10Eliminating IDOR Vulnerabilities & Security Hardening (PR #18)series completeBack to all articles →

Muhammad Fari Madyan

Senior Backend Engineer building real-time, high-concurrency systems that hold up in production. Co-founder of LampungDev. Based in Bandar Lampung, Indonesia (UTC+7), working remote.

Work

Case studiesCahTixExam platform, 4 stacksOpen source

© 2026 Muhammad Fari Madyan

Designed and built by Muhammad Fari Madyan