Skip to content

Ghi chú phát hành (Release Notes)

Sơ đồ phiên bản (Versioning Scheme)

Laravel và các package first-party tuân theo Semantic Versioning. Phiên bản major được phát hành hàng năm (~Q1), trong khi phiên bản minor và patch có thể phát hành hàng tuần. Phiên bản minor và patch không bao giờ chứa breaking changes.

Khi tham chiếu Laravel framework từ ứng dụng, luôn sử dụng constraint phiên bản dạng ^13.0, vì phiên bản major có thể chứa breaking changes. Tuy nhiên, chúng tôi nỗ lực đảm bảo bạn có thể nâng cấp lên phiên bản major mới trong một ngày hoặc ít hơn.

Named Arguments

Named arguments không nằm trong phạm vi cam kết backward compatibility của Laravel. Chúng tôi có thể đổi tên tham số khi cần để cải thiện codebase. Do đó, sử dụng named arguments khi gọi method Laravel cần cẩn thận vì tên tham số có thể thay đổi.

Chính sách hỗ trợ (Support Policy)

Với tất cả phiên bản Laravel:

  • Bug fixes: 18 tháng
  • Security fixes: 2 năm

Với các thư viện bổ sung, chỉ phiên bản major mới nhất nhận bug fixes.

(*) Các phiên bản PHP được hỗ trợ

Laravel 13

Laravel 13 tiếp tục chu kỳ phát hành hàng năm với trọng tâm vào AI-native workflows, default mạnh hơn, và developer API biểu cảm hơn. Phiên bản này bao gồm:

  • AI primitives first-party
  • JSON:API resources
  • Semantic / vector search
  • Cải tiến tăng dần trên queues, cache và security

Thay đổi nhỏ nhất (Minimal Breaking Changes)

Phần lớn nỗ lực trong chu kỳ phát hành này dành cho việc giảm thiểu breaking changes. Laravel 13 là bản nâng cấp tương đối nhẹ về công sức, nhưng vẫn mang lại khả năng mới đáng kể. Hầu hết ứng dụng Laravel có thể nâng cấp lên v13 mà không cần thay đổi nhiều code.

PHP 8.3

Laravel 13.x yêu cầu PHP 8.3 trở lên.

Laravel AI SDK

Laravel 13 giới thiệu Laravel AI SDK first-party, cung cấp API thống nhất cho text generation, tool-calling agents, embeddings, audio, images và vector-store integrations.

Với AI SDK, bạn xây dựng tính năng AI provider-agnostic (không phụ thuộc nhà cung cấp) với trải nghiệm developer nhất quán kiểu Laravel.

Ví dụ, prompt agent đơn giản:

php
use App\Ai\Agents\SalesCoach;

$response = SalesCoach::make()->prompt('Analyze this sales transcript...');

return (string) $response;

Tạo hình ảnh:

php
use Laravel\Ai\Image;

$image = Image::of('A donut sitting on the kitchen counter')->generate();

$rawContent = (string) $image;

Tạo audio:

php
use Laravel\Ai\Audio;

$audio = Audio::of('I love coding with Laravel.')->generate();

$rawContent = (string) $audio;

Tạo embeddings cho semantic search:

php
use Illuminate\Support\Str;

$embeddings = Str::of('Napa Valley has great wine.')->toEmbeddings();

JSON:API Resources

Laravel giờ bao gồm JSON:API resources first-party, giúp trả response tuân thủ JSON:API specification dễ dàng. JSON:API resources xử lý serialization, relationship inclusion, sparse fieldsets, links và response headers.

Bảo vệ chống giả mạo Request (Request Forgery Protection)

Middleware bảo vệ chống giả mạo request đã được cải tiến và chính thức hóa thành PreventRequestForgery, thêm kiểm tra origin-aware request đồng thời giữ tương thích với CSRF token-based protection.

Queue Routing

Laravel 13 thêm queue routing theo class qua Queue::route(...), cho phép định nghĩa routing mặc định cho job cụ thể:

php
Queue::route(ProcessPodcast::class, connection: 'redis', queue: 'podcasts');

Mở rộng PHP Attributes

Laravel 13 tiếp tục mở rộng hỗ trợ PHP attributes, bao gồm:

  • #[Middleware]#[Authorize] cho controller
  • #[Tries], #[Backoff], #[Timeout], #[FailOnTimeout] cho queue jobs
php
<?php

namespace App\Http\Controllers;

use App\Models\Comment;
use App\Models\Post;
use Illuminate\Routing\Attributes\Controllers\Authorize;
use Illuminate\Routing\Attributes\Controllers\Middleware;

#[Middleware('auth')]
class CommentController
{
    #[Middleware('subscribed')]
    #[Authorize('create', [Comment::class, 'post'])]
    public function store(Post $post)
    {
        // ...
    }
}

Attributes bổ sung cũng được giới thiệu trên Eloquent, events, notifications, validation, testing và resource serialization APIs.

Cache TTL Extension

Laravel giờ bao gồm Cache::touch(...) cho phép gia hạn TTL của cache item mà không cần lấy và lưu lại giá trị.

Laravel 13 tăng cường khả năng tìm kiếm ngữ nghĩa với hỗ trợ vector query native, embedding workflows và API liên quan.

Các tính năng này giúp xây dựng trải nghiệm tìm kiếm AI-powered bằng PostgreSQL + pgvector:

php
$documents = DB::table('documents')
    ->whereVectorSimilarTo('embedding', 'Best wineries in Napa Valley')
    ->limit(10)
    ->get();