AI Coding Tips for Laravel Developers

AI Coding Tips for Laravel Developers

If you’ve been watching the AI conversation from the sidelines, you’re not alone. Many Laravel developers have heard “you should be using AI” countless times, but haven’t taken the leap.

Maybe you tried to generate code once and the results were underwhelming or flat-out wrong. Or maybe you’ve just been waiting for the right moment.

With Laravel Boost now in public beta, that moment’s here.

Boost gives AI agents and editors direct access to your app’s context and Laravel-specific documentation. That context awareness solves the most common frustrations with AI coding. It knows your Laravel version, your preferred testing framework, your stack choices, and even your conventions. Instead of guessing, it answers from your reality.

We think you'll enjoy this more than any AI-powered coding experience you've tried.

Trying Laravel AI Coding for the First Time

So, how can you ease into this? If you haven’t adopted AI tools in your Laravel coding yet, you probably shouldn’t start installing and giving LLMs free rein to your production apps!

Below is a step-by-step guide to ease you into testing some AI workflows. Disclaimer: AI is changing fast, so take this as our current advice.

1. Choose Your AI-Compatible IDE or Editor

When you run php artisan boost:install, you’ll be prompted to select your editor from these supported options:

  • Claude Code: Anthropic’s AI-powered code editor that connects directly to Boost’s MCP server.
  • Cursor: VS Code-based editor with AI deeply integrated. Great for getting started quickly, with an interface many developers already know.
  • PhpStorm: Popular JetBrains IDE for PHP, supported through Boost’s MCP integration.
  • VS Code: Works with Boost when paired with supported AI extensions.

If you’re brand new to AI-assisted development, Cursor or Claude Code are the fastest ways to get up and running because they come with AI features preconfigured.

2. Install Boost

In any Laravel 10, 11, or 12 project running PHP 8.1+:

composer require laravel/boost --dev
php artisan boost:install

The installer will detect your chosen editor or AI tool and guide you through enabling features.

3. Open Your Project in Your Chosen Tool

If you picked Cursor or Claude Code, just open the folder and start chatting with the AI sidebar. If you chose PhpStorm or VS Code, follow Boost’s prompts to connect your IDE to its MCP server.

4. Start Small

Resist the urge to throw a giant feature request at the AI. That’s the fastest route to disappointment.

Instead:

  • Ask it to explain something in your codebase. “What’s the path from this form to the database?”
  • Highlight a method and say: “Write a unit test for this.”

You could write these yourself in minutes, but that’s not the point. The point is to see the AI understand your project and produce something useful.

5. Treat It Like a Junior Pair Programmer

You wouldn’t onboard a new teammate by saying “build this big feature” with no context. Same with AI:

  • Share relevant files.
  • Give explicit instructions.
  • Describe what “good” output looks like.

The more context you provide, the better the result.

6. Level Up Gradually

Once you trust it with small tasks, you can start giving it bigger ones:

  • Scaffold out a controller.
  • Suggest refactors.
  • Draft a feature test suite.

Always review the output and run your tests. Think of AI as a helper that speeds you up, not a replacement for your judgment.

Now’s the Time

Laravel Boost removes the “context gap” that made early AI experiences frustrating. Install it, start small, and see what’s possible.

If you find something great (or not so great), share your feedback with the Boost team. Boost includes a “report feedback” tool for frictionless feedback that goes straight from your editor to the Laravel team. We’re building this for you.

Keep reading

General April 4, 2024

Encryption and the In-between

Last year, we introduced a simple but surprisingly useful feature to Laravel Forge: the ability to add notes to servers. While checking the uptake of this feature, we noticed that customers were often storing sensitive data in the field. We hadn’t designed notes to store sensitive information, so we found ourselves in a situation where we now needed to encrypt existing unencrypted data, while also allowing for new data to be inserted as encrypted data - at the same time, the dashboard needed to be able to show the notes correctly whether they had been encrypted or not. Our migration process looked like this: 1. Run a command that encrypts all existing unencrypted server notes. 2. Update our model to cast the `notes` field, encrypting or decrypting as required. To do this, we leaned on [Laravel’s custom casts](https://laravel.com/docs/11.x/eloquent-mutators#custom-casts) feature to handle this “sometimes encrypted” data. We created a new cast `SometimesEncrypted` that allowed us to gracefully decrypt the encrypted notes, or simply return the plaintext version which may have been available during the migration: ```php

James Brooks

General December 19, 2022

Laravel Loves PHP 8.2

Last week saw the official release of PHP 8.2, bringing with it features such as read-only classes, DNF types, and much more. As you may have noticed, we've been busy preparing the Laravel framework, first-party packages, and the surrounding ecosystem to provide support for this exciting new release of PHP. ## Laravel If you want to use PHP 8.2 with your Laravel project, you should update your dependencies to use the latest versions of the framework as well as the latest versions of all first-party packages such as Cashier, Passport, Scout, etc. ![image](https://laravel-blog-assets.s3.amazonaws.com/cuNz2q7vmF8us0h934JhSY5hprK8lAAZPXw0siF4.png "image") Of course, you should also ensure you update any third-party packages accordingly. ## Forge If you use Forge to provision servers and deploy your applications, you may now select PHP 8.2 when creating a server. ![image](https://laravel-blog-assets.s3.amazonaws.com/yB1Yo6zGuJFpwyQIJeOW1SoD5ZWwiU7Tdh23c1cC.png "image") You may also install PHP 8.2 on existing servers from the "PHP" tab of your server's management dashboard. ![image](https://laravel-blog-assets.s3.amazonaws.com/PeQjgVeQlbYkqJGMyEw4N6eZVb8Q8nfVL7wAdzlR.png "image") ## Vapor We have also updated Vapor to provide PHP 8.2 support for our native and Docker runtimes. To update your native runtime to PHP 8.2, set the `runtime` option of your application's `vapor.yml` file to `php-8.2:al2` and redeploy your application. ![image](https://laravel-blog-assets.s3.amazonaws.com/O3QpHQ2GEvCxUCvkw59b8xiDvInhFqsOwIHd5PfV.png "image") If you are using the Docker runtime, you may update the base image in your Dockerfile to `laravelphp/vapor:php82` and redeploy your application. ![image](https://laravel-blog-assets.s3.amazonaws.com/6Lfm3nfio9eUHv9z0oNdEzfdrZH5NOyuOHxbps9I.png "image") ## Envoyer If you use Envoyer to manage your application's deployments, you may now select PHP 8.2 from your server's settings. ![image](https://laravel-blog-assets.s3.amazonaws.com/FswmEfdErIUr7iFQKQZkKM5TyEWEs3jbNawQOQfI.png "image") At Laravel, we're committed to providing you with the most robust, modern, and developer-friendly PHP experience. We hope you're as eager as we are to get started with PHP 8.2. With these updates to the ecosystem, it really couldn't be simpler!

Joe Dixon

General August 9, 2022

Laravel: New DB Commands

Following last week's release, which again focused on Artisan, this week Laravel v9.24 introduces three new DB commands and more.

Taylor Otwell

Stay connected with the latest Laravel news