Skip to content
Programing

Laravel 13: The AI-First Framework Official Release

Published: Duration: 5:55
0:00 0:00

Transcript

Host: Alex Chan Guest: Jordan Vance Host: Hey everyone, welcome back to Allur, your weekly deep dive into the world of PHP, Laravel, Go, and everything in between. I’m your host, Alex Chan. Now, if you’ve been following the PHP world lately, you know the atmosphere has been… electric. For years, there’s been this nagging question: "Is PHP going to be left behind in the AI revolution?" Well, the Laravel team just dropped an answer that is less of a whisper and more of a roar. Host: I am joined by Jordan Vance. Jordan is a Lead Software Architect at Nexus Labs and a long-time contributor to the Laravel ecosystem. Jordan has been playing with the beta builds of version 13 for months now, trying to break things so we don’t have to. Jordan, it is so good to have you on Allur. Guest: Thanks, Alex! It’s great to be here. Honestly, I haven’t slept much since the release—there’s just so much to unpack in this version. It really does feel like a "new foundation," like they said in the docs. Host: Right? I mean, let’s start there. The "AI-First" branding. When I first heard that, I’ll be honest, I rolled my eyes a little bit. I thought, "Oh, another wrapper for OpenAI." But then I looked at the implementation. What’s your take? Is this a gimmick or a paradigm shift? Guest: I had the same reaction! I was like, "Really? AI in the core?" But, actually, once you use the new AI SDK, it clicks. Think about the `Storage` facade. We don't think twice about swapping local storage for AWS S3 with one line in the `.env` file. The Laravel 13 AI SDK does that for LLMs. You can use OpenAI for production, Anthropic for specific reasoning tasks, or even a local Ollama instance for testing—all using the same syntax. Host: Oh! So it’s that abstraction layer that makes it feel "Laravel-y"? Guest: Exactly. Like, if you want to send a prompt, you just call `AI::chat()`, chain a system prompt, and hit `send()`. But the *real* "aha moment" for me was the testing. Before, testing AI integrations was a nightmare—you’re mocking Guzzle clients or dealing with expensive API calls during CI. Now? You just call `AI::fake()` and it works just like `Mail::fake()`. It takes the "scary" out of AI development. Host: That’s a huge win for enterprise teams. But okay, let's talk about the thing that actually made my jaw drop: `whereSemantic()`. This is integrated directly into the Query Builder. Tell me how that works in the real world. Guest: This is the game-changer. Usually, if you wanted "semantic search"—you know, searching by *meaning* rather than just keywords—you had to set up a vector database, learn how to generate embeddings, manage a separate pipeline... it was a whole thing. In Laravel 13, you can literally take a `Product` model and call `whereSemantic('description', 'ergonomic chair for back pain')`. Host: Wait, so it’s not just doing a `LIKE %back pain%` query? Guest: No, not at all! It’s actually doing a vector search. Behind the scenes, Laravel 13 handles the embedding generation. It sends your string to an embedding model, gets the numbers back, and queries your database—like PostgreSQL with pgvector. It’s democratizing technology that used to require a dedicated data engineer. I actually implemented a support bot for a client last week using this and RAG—Retrieval-Augmented Generation. We did in four lines of code what used to take me a week of configuration. Host: That is wild. But to run all this, we have to talk about the "price of admission." Laravel 13 strictly requires PHP 8.3. I know some devs are still sweating about upgrading from 8.1 or 8.2. Why the hard line on 8.3? Guest: Yeah, the upgrade cycle is real. But honestly, for what Laravel 13 is doing, they needed the 8.3 features. Things like `json_validate` and the improvements to the `readonly` modifier... they provide the performance overhead needed for these intensive AI tasks. Plus, it pushes the ecosystem forward. I will say, though, if you’re upgrading, definitely use Laravel Shift. It makes the jump to 8.3 and v13 way less painful. Host: Speaking of "less painful," let's talk about the "Clean Stack" and this shift toward PHP Attributes for routing. This is a big departure from the traditional `routes/web.php` file we’ve used for a decade. How are you finding it? Guest: It’s controversial! Some people love their central route file. But in Laravel 13, you can define your routes directly on the controller methods using Attributes. So, right above your `show` method, you just put `#`. Host: I can see that being a massive win for "locality of reference." No more jumping back and forth between files to see where a URL points. Guest: Exactly! And it’s not just routes. You can apply middleware the same way. `#` right on the method. For large-scale DDD—Domain Driven Design—apps, this is a dream. You keep your domain logic, your routing, and your security all in one place. Plus, tools like Larastan can read those Attributes much better than string-based route files, so your type safety goes through the roof. Host: Interesting! So it’s actually making the app more robust, not just "cleaner" to look at. Was there anything that tripped you up when you first started using it? Any "real-world" struggles? Guest: Oh, for sure. The "Clean Stack" philosophy means the `app/` directory is even leaner now. If you're looking for where the "magic" happens, there’s less boilerplate to look at. For a newcomer, it might actually feel *more* magical until you understand how the service providers are being handled. And you really have to pay attention to the new `config/ai.php` file. If you don't configure your providers right, the whole AI SDK obviously won't work. It’s a lot of power, but you have to read the docs. Host: "Read the docs"—the eternal developer struggle. But it sounds like the ecosystem is ready. I heard Breeze and Jetstream already have hooks for the AI SDK? Guest: They do. You can spin up a new Breeze app and have a functional AI-powered starter kit in minutes. It’s honestly a bit surreal how fast the PHP community has moved on this. Host: It really feels like Laravel is trying to prove that PHP isn’t just a "legacy" language for CRUD apps, but a serious contender for the "Intelligent Web." Guest: I think they’ve proved it. Laravel 13 isn’t just an update; it’s a statement. Host: That is a perfect place to wrap it up. Jordan, thank you so much for sharing your experience with us today. This has been eye-opening. Guest: My pleasure, Alex. Happy coding everyone! Host: If you want to dive deeper into Laravel 13, head over to the official Laravel docs or check out Laravel News for the full breakdown of the AI SDK. We’ll also have links in the show notes for Jordan’s blog and some resources on getting started with pgvector and PHP 8.3.

Tags

llms software engineering open-source web development backend php laravel