What's New in Laravel 13: Vector Search, PHP Attributes, JSON:API Resources & More

Laravel| 00:23:29|Mar 24, 2026
Chapters8
Introduces Level 13 and emphasizes an easy upgrade path with minimal breaking changes.

Laravel 13 brings AI-native features like vector search, JSON:API resources, PHP attributes, and the Laravel AI SDK, plus smoother upgrades with Level Boost.

Summary

Laravel 13 from the Laravel channel elevates the framework with AI-first workflows, stronger defaults, and more expressive APIs. Taylor Otwell highlights PHP 8.3 as the new minimum and promises bug and security support through planned quarters, noting upgrades should be unusually painless for most apps. The video dives into practical features, starting with native vector and semantic search, including an embedding column and OpenAI integration to power meaning-based queries over recipe data. PHP attributes arrive as a decorative alternative to traditional class properties, enabling on-controller middleware, authorization, and other settings. JSON:API resources land as first-party tooling, aligning Laravel’s API responses with the JSON:API spec and improving relationship handling with included data. The Laravel AI SDK is showcased alongside an example agent for a recipe search workflow, plus a reusable tool to query the database via embeddings. The host demonstrates Level Boost to automate upgrades from Laravel 12 to 13, including cloud code prompts and an MCP-based upgrade flow. Finally, the video closes with a quick reminder that this upgrade path minimizes friction and invites viewers to try the new capabilities in their own apps.

Key Takeaways

  • Laravel 13 requires PHP 8.3 at minimum, with bug fixes through Q3 of 2027 and security fixes through Q1 of 2028, signaling a long-term support window.
  • Vector and semantic search are native to the query builder, using an embedding column (e.g., embedding) and OpenAI-based two embeddings conversion to power similarity scoring.
  • To use vector search, you create an embedding from title and description, store it in PostgreSQL, and query with whereVectorSimilarTo and a tunable similarity threshold.
  • PHP attributes replace or complement class properties for common configs (fillable, hidden, middleware, authorize) across controllers, jobs, and routes for cleaner syntax.
  • JSON:API resources arrive as first-party, providing type, id as string, and attributes in a standardized JSON:API structure with includes for relationships.
  • Laravel AI SDK (first-party) unifies text, embeddings, agents, and tools, enabling end-to-end AI features inside apps, including an example recipe agent and a tool for DB searches.
  • Level Boost accelerates upgrades from Laravel 12 to 13, using an MCP/Cloud Code flow to run tests, adjust dependencies, and deploy with minimal manual steps.

Who Is This For?

Laravel developers upgrading to 13 who want to leverage AI features, set up semantic search, or build AI-assisted APIs. It's especially helpful for teams exploring first-party JSON:API resources and AI agents in production apps.

Notable Quotes

"LA 13 now requires PHP 8.3 as the minimum version."
Announces the new minimum PHP version for Laravel 13.
"Vector query support to the query builder combined with the new two embeddings helper."
Introduces native vector/embedding-based search.
"JSON API resources. Laval now ships with first-party JSON API resources."
Highlights first-party JSON:API support.
"With the Level AI SDK, we have the concept of an agent to help find recipes from our database."
Demonstrates AI agent use within the app example.
"Level Boost makes upgrades from level 12 to 13 almost frictionless via cloud code and MCP guidance."
Shows the smooth upgrade workflow.

Questions This Video Answers

  • How does Laravel 13 implement native vector search with embedding columns in PostgreSQL?
  • What are JSON:API resources in Laravel 13 and how do they differ from traditional JSON resources?
  • How do PHP attributes change how I declare middleware and fillable fields in Laravel 13?
  • How can I use the Laravel AI SDK to build an AI agent for recipe search?
  • What is Level Boost and how does it simplify upgrading a Laravel app to 13?
Laravel 13PHP 8.3Vector searchSemantic searchOpenAI embeddingsPostgreSQL vector columnsJSON:API resourcesPHP attributesLaravel AI SDKLevel Boost upgrade flow
Full Transcript
Hello L friends. Lar 13 is here. The clean stack for artisans and for agents. This release is all about AI native workflows, stronger defaults and more expressive APIs. Like always, let me show you. [music] So first things first, LA 13 now requires PHP 8.3 as the minimum version. Bug fixes [clears throat] will be provided until Q3 of 27 and security fixes until Q1 of 28. The good news, this is probably one of the easiest major upgrades we ever had. The team really focused on minimizing breaking changes. So for most applications, you can just upgrade without changing much of your code. But why this has become so easy to upgrade, I will show you at the end of the video. Now before we go into the big features, let me quickly go over a few of nice but small additions. First, we have a cache touch method which lets you extend the TTL of a cached item without having to fetch and restore it. Thank you YTS. The next level CSRF protection got an upgrade with a new prevent request forgery middleware which adds an original aware request verification on top of the existing token paste protection. Thank you, Ben. And finally, you can now pause and resume your scheduled commands with schedule pause and schedule resume. Thank you, Jack. All right, but now let's get into some of the bigger features here. First up, we have semantic and vector search. Level 13 adds a native vector query support to the query bill combined with the new two embeddings helper. This is really powerful. Let me show you. In this level 13 application, I have recipes. And if we take a look at the table, you can see that we have here a bunch of recipes with title and description like pasta, oats, dough, curry and so on. So if we now want to let our users search for specific recipes, you can do this on your front end and probably this will look something like this. is I've created here an artisan command which we can trigger with artisan recipe search then what we're searching for and here we're just quering the recipes table for where something is where the title is like the query or the description is like the query so something very simple you've probably seen this before php recipes search and now we're searching for pasta and fair enough we get our 15minut pasta result back, which is great. But yeah, keyword search, that's what it's called. We're searching for a specific keyword. It has to be this keyword. And if we change this a little bit. So, for example, to pasta, we already don't get anything back. Of course, this would be quite easy to fix, but yeah, keyword search has it limitations. So, if I would use a different word than pasta, like spaghetti, it wouldn't find anything here. That's why there are also other types of search. For example, semantic and vector search. When you take a look at L's documentation for search, you will also find here semantic and vector search. And I think it's very well explained here. So, semantic search takes a fundamentally different approach. It uses AI generated vector paddings to represent the meaning of text as an array of numbers and then finds results whose meaning is most similar to the query. So, this is very interesting. So we're going to use the text like the title and description and we're creating a vector embedding from this text which is an array of numbers here. And then with those array of numbers we can compare it to another string and find similar results to the other string. So this means if we would look for pasta it would find those examp recipes with pasta. But if I look for spaghetti it probably should also find it. Or here we have another example. If you're looking for best wineries in Naper Valley, you will also find an article called top wine yards to visit which yeah is different from what you were searching for in keyword search would not work here. Okay, what do we need here in order to make this work first? We need the lava AI SDK installed which I have already done here and you also need to set up a model. I'm going to use OpenAI and I've already set up an Open AI key in my environment file. Then what also comes with level 13 is a vector column here. And yeah, we're going to call it embedding. This will be the embedding for each recipe. And we're going to also add an index here. And I think I haven't mentioned it. The database that I'm using here is Postgress. So in order to make use of vector embeddings inside the database storing this you need postrest table which I've created here locally with level her. Okay. Um this is the name of the field and this is not a size of this field which depend on which um AI embeddings model you're using. If you're using open AI then this is the correct one. If you're using other ones you need to look up. There might be other sizes and these are important to take the correct ones. All right, let's refresh the database, this should already work. And then inside our cedar recipe cedar, we need to change something here because next to the title and description, we are now also adding embedding. Okay. So what we're doing here we have now we're adding now new to the new embedding field which was just created in migration a string and the string we're using is the title of the recipe added to the description and then we're using a new method on the string helper which is called two embeddings which is going to create this array of numbers here through our open AI model here in this case. Okay. And let's try this out. But if we're now going to seed, you will probably see that this is now failing here. And the reason is, let's take a look. Array to string conversion. Yeah. So the issue here is that inside our recipes model, we also need to make sure that we can fill embedding here too. And we also need to make a cast to make sure that embedding is being casted to an array. Okay, let's try again. And I hope it should be working now. Let's take a look. Unique coralation. Okay, I think we need to run the migrations here again. A fresh one. And now we should be able to seat our database. And with a little bit of luck, it's working. All right, let's take a look at the database here again. Let's refresh. And we should here see this new column embedding. Yeah, with just an array of lots of numbers here, which just makes us makes it possible that we look for similar meaning to a specific query to what we have stored here. Again, this is a combination of the title and the description. Okay. So, what does this mean for us? So, instead of making this, so instead of looking here for keyword search, what we can do is we have now a new method here. um where vector similar to and we're defining here the column here on the recipes model which is embedding then the query here is what we get here through our command and then we're going to define how similar it should be. So this goes as a number which goes from 0 to one and by default it's 0.6 six. But we are going um let's try with the default first. All right. Okay. I think this should be enough. Let's try again with pasta which is exactly the same word which is not working here. I'm pretty sure that's because of the similarity here. Let's go with 0.3 for example. I think now we should get something back. Yeah. So keyword search semantic search is quite different from this semantic search. So that's even though we're using pasta, we also have to make sure we're using the right similarity value here. So and as you can see, we also get a couple of um recipes back because they are in some way also similar to the pasta which we're looking for. Of course, it doesn't make much sense to show here ratoto or the pizza dough. But yeah, in terms of our vectors, they are similar. But mostly interested, we are in the first one, which is correct. But now it's also interesting. We can also search for something something quick for dinner, which is now way different from what we're searching before because no none of these words are probably inside our recipes title or description. But still, we're going to find a couple of results. Again, our pasta here, which seems like it is fast to make, but also this one pit lentil, one part lentil soup, and also this salad here. So, as you can see, vector embeddings are pretty powerful because yeah, we get um similar result to what we're looking for. If you want to make a user, yeah, let's search for something for synonyms or something that's just similar to what they're looking for, then this is a very good approach. Next, PHP attributes, and this is a big one. Level 13 now lets you use attributes like middleware, authorize, back off, and more directly on your controllers and jobs. Everything becomes more decorative if you want to. In a new level 13 application, if you go to the default user model, you will already be created by two new PHP attributes which we use in level fillable and hidden. So these were two things that before were only um available through class properties which looked something like this. But now you can you can still use those if you prefer it or if not you can use our new PHP attributes here for fillable and hidden. But yeah in general with these new PHP attributes we are replacing or giving you another option to define class properties which we have done here. Or if we go for example to my post controller here, you can also see I can also replace options which I have set through routes like a middleware which I now can also do on the controller and I can also define the middleware and also the authorizes on the method itself which you can see here. And this goes even further. If I go to a job I think I have a job here. Yeah, like this one here. We also have now a couple of options which were before being defined by class properties which again is still possible but now you can also do this through PHP attributes which I believe look really nice. Thank you Yuran. Now JSON API resources. Laval now ships with a firstp party JSON API resources. So building spec compliant APIs no longer requires any third party package. All right within Lava 13. We already had JSON resources in level but now we have also ones that follow the famous JSON API spec. So let's take a look what this looks like. So JSON resource we still have them um look like this. For every item here in this case it's a UDM model inside the data object we have all the items that we are going to share here for JSON API resource which is new. This looks a little bit different. There's again a spec that defines how they should look. We have an ID and a type. ID always needs to be a string here in this case. Good to know. And the type comes here from the user model name. And then all the fields are inside attributes. This is what this looks like. And if we take a look at a collection, pretty much the same. Now we have an array of items again. Before everything was inside the object here, all flattened out. And here, now we have for every item here the ID, the type, and then the attributes like this. But it gets even cooler when we take a look now at includes here, which just means we're having some relationships here on the left. Um, you probably have seen this before. We have the item and then for every item we have the name of the relationship post in this case and then all the data in here and then for the second user here the same. And now what's different here is for the JSON library resource is that for every relationship it's called relationship here and then the name is post. we only have the ID and the type. And then if we scroll a little bit down here then we have included. So the relationship items are included and here now we have the full items here with all the attributes. And the idea behind this if some users here in this case use the same post then we don't have duplicated code which when I think about it is pretty smart. So this is what this looks like and yeah again this is pretty cool. back inside the code those look a little bit different now. So this is the user resource what we had before where we define what we want to share with the two array method and here now we have the JSON API resource for our users here and what's different here now again we have attributes where we define what we're going to share which fields here and then I have the relationships and also a two type method where we define what is the name of the type. So please check out our new JSON API resources. I think they are really really useful. And then of course there's our friend the Laval AI SDK. It's a separate firstparty package that gives you a unified API for text generation, agents, embedding, images, audio, everything you need to work with AI. We are going to continue our example where we're searching for recipes through a vector search. But now we're bringing some more AI into this example by using an agent. So with the level AI SDK, we have the concept of an agent. And an agent is a kind of an specific assistant with some specific of a specific use case. In our case, this should be our recipe agent which should help us in order to find some recipes. So we don't need generate structured output. We just want the strings back when we talk to the AI. Okay. So now we have under agents this recipe agent which is a PHP class which you can see here with some first some instruction. So here we're telling some instruction to the AI model. What are what is the baseline here? What are we going to do? This is something that we will have for every new conversation. So we're telling the assistant assistant how it should behave. So you are um recipe assistant. You will try to find the right recipes from our database only for the user. Okay, I want to be very precise here so that the AI because the AI has a lot of imagination, a lot of research, we only want this assistant to search through our own recipes which we have in the database which I've shown you before already in the other example. Okay. Um I think that's it for now. We have messages. So if we have a conversation, we could fill this new conversation with some old messages so that the AI model has some context. And then we have also tools here. So we're also going to need a tool. So let's make another one. PHP make tool and think of a tool as a little helper here for the eye for the eye conversation for example to give it access to our database. So because we want to let the AI search through our database and we can do this very easily through this tool here. This is now called search recipe. And first the description search for recipes in our recipes table. All right. And now inside the handle method we are going to grab some of those recipes very similar to what we had before through a vector search. All right. So this is what we already had in the last example. We're quering our recipes table. We're using the new war vector similar to the embeddings column here. And then what we get back here is I think it's called value because for every tool you need to define the schema here and by default it's just value what we get back and yeah we keep the similarity here by 0.3 so we get some results back maximum of three we are returning if there are no respon no matching recipes and then for the AI we're also mapping it to a big string with title and description. So this is now very handy for the AI because when someone is asking for a recipe the AI knows okay there's this tool I can use it I can check this database it sees some of the recipes which we get back and then the AI can decide what to do which one to suggest and then the only thing left is how we're going to trigger this. I'm going to use here locally an artisan command again because this is very handy for testing. So we have your new design command recipes ask then we're providing our question as a string then we're using this nice spin helper from lava prompt in order to show a spinning sign so that the eye is working and we are making here a new recipe agent um agent and then we're creating a new prompt asking the eye with our specific question and then we're just providing the string what we get back from the eye. So very simple here. Okay, let's give this a try. Now we're going to trigger our artisan command with recipes ask. And then our question is I am in the mood for something healthy. And as you can see, this is now way different from just doing a query search or I mean the the vector search would help and will help of course, but now the AI can help us even more and you're going to see why in just a minute. But if we take a look at the results now, let's say, could you tell me a bit more about what you're in the mood for? So, um, it seems like it's working, but it's not actually suggesting anything yet. And it's not because it needs more info. It's because we haven't provided our tool yet to the agent. So, if we go back to the agent here inside the tool array, we need to provide our search recipe tool. And now with a little bit of luck here, we should see now right from the start some suggestions. So let's see. And yeah, okay, this is way better because I know these are recipes from our recipes table. So this means it's already directly suggesting some options here. But of course, it can narrow down the options by providing some more information. And yeah, think of this as a chat that would be inside your website and with a nice UI where we can directly have a conversation about the recipes that you need for today or for the rest of the week. And I think this is now a very powerful example here where we're making sure we can make use of our vector search through the database and then combine it with our recipe agent which we can create through the level AI SDK in just a couple of minutes and you have your digital AI assistant which you can push to your application. This is just so cool. And finally, let's talk about upgrading again. Like I already said at the beginning of the video, this is one of the smoothest major upgrades yet. And with level boost, it gets even easier. I do have here a level 12 application. Let's make sure by checking this out here 12.55. And now I want to upgrade it to level 13. And we have some great upgrade guides on the level docs which you can check out. And as usual, there are not many changes here, but there are a few. And yeah, it's always a little pain to upgrade your application. It is something that, yeah, can be even nicer. And it is even nicer now with lava boost. So let me show you. Um I guess in most of your application you already have level boost installed or you should because it's just amazing especially when working with AI agents like cloud code. So we're going to require it here level boost because I want to give you this full flow here. Yes, we want to add it as a deaf dependency. All right. And then we also need PHP artisan boost to install lava boost. And there are a few things that we get here. Guidelines skills and our MCP server. We don't need the herd MCP one here. And for this example, I only need to configure it for cloud code. There are a lot of coding agents out there. We support most of them, which is pretty nice. But yeah, now we're good to go. So this means when we now open up cloud code here and you type here the slash you get some of some of the tools from cloud code itself but also some prompts which come through our MCP server and the first one here is already an upgrade from level 12 to level 13. So if we just click this now cloud code is working on upgrading our application for us. I mean how cool is this? It's now going to check everything. what's the current release? It's going to um drag out the branch. It's going to check out the tests here. So, the tests are passing, which is always a good idea to do this before doing the upgrade. And yeah, then it's going all of its magic. We have provided a lot of information here through our MCP server on how to upgrade this application to Lava 13. And yeah, this will take now one or two minutes, I guess, for this simple application. And then we should be ready. And in between you're going to see some of the changes here. I'm going to allow all of them. One of them are just the simple changes in the composer JSON file where we're upgrading um the dependencies. And yeah, in between you will see some others ones. So for example, we need PHP unit 12 here and so on. Yeah, in between you will also see some other changes here which we have here like for the session keys which have changed or serialized classes where we can define which classes are allowed to be serialized and then at the end here it's now running our tests again to make sure our tests are still passing. Then it's also running pine. So all the important things that you need for upgrading an application and I think we are already done. I think this is already now just information about what has happened. I think we're good to go. Let's get out here and let's take a look. PHP artisan version which is now 131.1. And if we're going to run our test, they should also pass. And they do. So yeah, this is super amazing. I think this is not the best way to upgrade your level applications with AI with level boost all together in just a couple of minutes here. As you have seen, this is really, really amazing. And that's lava 13. Thank you to all the contributors who made this release happen from our team itself, but also from the outset. If this video was helpful, please hit the like and subscribe button. Have fun with Level 13 and see you in the next one. Bye. [music]

Get daily recaps from
Laravel

AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.