[0:00] Laravel 13 is finally here, but this is [0:03] not our typical Laravel release because [0:06] in this upgrade there is no massive [0:09] breaking changes, no big a structural [0:11] shift like Laravel 11, but still some [0:15] very important improvements that can [0:17] impact your real world applications. Hi [0:20] everyone, this is Umesh Rana and welcome [0:23] back to Programming Fields where we [0:25] focus on building real world production [0:27] ready applications using modern [0:29] technologies like Laravel and React. [0:32] In this video, I will explain Laravel 13 [0:36] in a very simple and practical way. So, [0:38] even if you are new to these features, [0:41] you will clearly understand what is new, [0:44] why it matters, and where you can use [0:47] it. And if you're serious about becoming [0:49] a better developer, make sure to [0:51] subscribe to Programming Fields and hit [0:53] the bell icon because this is just the [0:56] beginning of our Laravel 13 deep dive [0:59] series. And in this video, we will go [1:01] step-by-step starting from what Laravel [1:04] 13 is, then moving into features, and [1:07] finally understanding whether you should [1:09] upgrade or not. And before we jump into [1:12] the details, let's quickly look at what [1:14] we're going to cover in this video. [1:16] First, we will understand what Laravel [1:18] 13 is and what type of release this is. [1:21] Then we will look at the breaking [1:23] changes. After that, we will go through [1:25] all the important new features with [1:27] examples, and finally, we will discuss [1:30] whether you should upgrade your Laravel [1:32] version or not. [1:33] So, make sure you watch till the end, [1:35] especially if you are planning to [1:37] upgrade your project. So, we will start [1:40] from what is Laravel 13. [1:42] So, Laravel 13 is not about big changes. [1:46] It is about making Laravel better and [1:48] more future ready. [1:51] And you can think of it like improving [1:53] what already works well. So, if you are [1:55] expecting a big rewrite, this is not [1:58] that release. And this release primarily [2:01] focuses on the performance improvements [2:04] and future ready for AI and modern PHP [2:07] development. [2:08] Now, we will talk about breaking change. [2:11] So, in Laravel 13, this does not support [2:14] PHP 8.2. And as per the official [2:17] documentation, Laravel 13 supports [2:19] minimum version of PHP 8.3. So, this is [2:23] the only important breaking change. [2:25] Laravel 13 requires PHP 8.3 because [2:29] Laravel can now use modern PHP features [2:33] which improve performance and code [2:35] quality. [2:36] So, before upgrading, make sure your [2:39] system supports PHP 8.3 version. [2:42] Now, we will talk about very first [2:44] feature of Laravel 13, which is PHP [2:47] attributes. So, the PHP attributes is a [2:50] modern PHP feature which provides a [2:53] cleaner alternative to properties or [2:56] configuration in classes. And in [2:59] Laravel, we can use it in every classes [3:02] like jobs, models, controllers, [3:05] commands, notifications, etc. So, we [3:08] will see this syntax using examples. So, [3:11] here in the first example, we are [3:13] applying rate limiting directly to a [3:16] method inside controller. [3:18] And this keeps everything clean, [3:20] organized, and easy to read. [3:23] Previously, we had to define this [3:25] throttle in the routing, right? Now, if [3:28] you'll take a look to the second [3:30] example, this is a model class. [3:32] So, here in previous versions of [3:34] Laravel, we had to define the fillable [3:37] property, hidden property, or even table [3:41] name. We had to define it using this [3:43] access a specifier as protected, right? [3:46] Now, in Laravel 13, here in the model [3:50] itself, we can define the fillable [3:52] property, table name, and even we can [3:56] type cast the fields using attributes [3:58] itself. Now, in the third example, we [4:01] can apply this attribute in the [4:03] validation as well. [4:05] So, instead of writing validation rules [4:07] in arrays format, you can define them [4:10] directly using attributes in this way. [4:13] And if you are familiar with Livewire, [4:16] then Livewire 3 was following the same [4:18] approach. So, the benefits of using [4:20] attribute is this provides cleaner [4:23] structure, easy to understand, and less [4:26] boilerplate code. And these are examples [4:29] to help you understand how attributes [4:31] work conceptually in Laravel 13. [4:34] But don't worry if this feels new, we [4:37] will cover attributes in detail in a [4:39] dedicated video with real projects. [4:42] Now, we will jump to the next feature, [4:44] which is cache touch function. [4:47] So, let's understand this using this [4:49] example. [4:50] So, let's say you have stored user data [4:53] in cache for 10 minutes. Normally, after [4:57] expiry, you need to fetch data again [5:00] from database in order to set into the [5:03] cache. But with cache touch function, [5:06] you can extend the cache time without [5:08] fetching data again from the database. [5:12] So, why this is useful? Because this [5:14] will reduce the database query. So, now [5:18] when the cache will expire, you don't [5:20] need to fetch that data from the [5:22] database again. Instead, you can extend [5:25] the cache expiry time without fetching [5:27] it from the database. [5:30] Next, this will improve the performance [5:32] and saves server resources. All right. [5:36] So, if a user is active, you can keep [5:38] extending cache instead of reloading [5:42] data. [5:43] Now, we will jump to the next feature, [5:45] which is AI integration. So, Laravel 13 [5:48] introduces official support for AI. [5:52] Now, you can build intelligent features [5:55] like chatbots, a smart search systems, [5:58] recommendation engines, and this is [6:01] optional. So, Laravel is not forcing to [6:04] use AI, but it is uh preparing for the [6:07] future. And we will cover this in a [6:10] detail in a separate video. Now, next [6:12] feature we have passkeys. So, passkeys [6:15] allow users to log in without passwords. [6:19] Instead, they use Face ID, fingerprint, [6:23] and device authentication. [6:25] And the benefits of using the passkeys [6:28] for the authentication is this provides [6:30] better security and better user [6:33] experience. And this is already being [6:35] used in modern applications. [6:38] In previous version of Laravel, that [6:40] means in Laravel 12, we had to use a [6:43] third-party library as WebAuthn [6:46] authentication for handling this [6:48] passkeys authentication, right? [6:51] But in Laravel 13, this supports [6:53] internally. So, we will see that in the [6:56] practical way. Now, we will jump to the [6:58] next feature. [7:00] We have Reverb driver. [7:03] So, earlier for WebSockets, you needed [7:06] Redis. Now, Laravel allows you to use [7:09] database instead. So, why this matters? [7:12] Because this provides easier setup, [7:15] lower cost, and good for small projects. [7:19] Next, we will talk about the JSON API [7:21] response. So, Laravel improves JSON API [7:25] responses. And this is very important [7:28] for front end because front end gets [7:31] consistent data from the back end using [7:33] API response. [7:35] And this will be easy to maintain. [7:37] Especially, this is useful if you are [7:40] working with React or mobile [7:42] applications. Now we will talk about the [7:44] improvements in Laravel 13. So in [7:47] Laravel 13, this improved queue [7:49] handling, faster performance, cleaner [7:52] code base, and updated a few [7:54] dependencies internally. [7:56] So these improvements may not look big, [7:59] but they are very important in [8:01] real-world applications. They make your [8:03] applications faster, more stable, and [8:06] easier to maintain. [8:08] Now we will talk about the deprecation [8:10] in Laravel 13. [8:12] So Laravel 13 does not remove many [8:15] features. The only major change is [8:17] dropping PHP 8.2 support. [8:20] So upgrading is relatively safe. So in [8:24] Laravel 13, we will have to use at least [8:26] PHP 8.3. Now last but not least, we will [8:31] discuss about should you upgrade from [8:33] previous version to Laravel 13? So the [8:36] answer is if you are starting a new [8:38] project, go with Laravel 13, which is a [8:41] latest version. But if your project is [8:44] already stable, you can upgrade later. [8:47] And if you are on PHP 8.2, you will have [8:50] to upgrade PHP version first. So that's [8:53] a complete and simple explanation of [8:55] Laravel 13. In the next video, we will [8:58] install Laravel 13 step-by-step and [9:00] understand the project structure in [9:02] detail. [9:03] And in this series, we will also build [9:05] real-world applications using Laravel [9:07] 13. So if you don't want to miss that, [9:10] make sure to subscribe to Programming [9:12] Fields and hit the bell icon. And let me [9:14] know in the comments, are you planning [9:16] to upgrade to Laravel 13 or not? So once [9:19] again, thanks for watching and I will [9:20] see you in the next video.