Extensions · · 6 min read

The agent that understands your Laravel project before it writes a line - Elyra v0.7.12

Every coding agent can write Laravel code. You ask for a model, you get a model. You ask for a controller, you get a controller. The syntax is correct, the imports are right, and the code runs.

The agent that understands your Laravel project before it writes a line - Elyra v0.7.12

Then you notice it created a service class in a project that uses actions. It added a resource controller where every other controller is invokable. It put the model in app/ instead of app/Models/. It forgot the policy. It used PHPUnit assertions in a Pest project.

The agent wrote valid Laravel. It just didn't write your Laravel.

The problem is context, not capability

When you ask an agent to add a comments feature, it needs to answer a dozen questions before writing anything:

  • What relationships does Post already have?

  • Does the project use actions, services, or fat controllers?

  • Are controllers invokable or resource-style?

  • Is auth handled by Sanctum, Passport, or Fortify?

  • Does the project use Pest or PHPUnit?

  • Are there factories for the existing models?

  • What middleware pattern do the routes follow?

Without these answers, the agent guesses. Sometimes it guesses right. Often it doesn't, and you spend the next twenty minutes fixing conventions instead of building features.

Three tools that replace guessing with knowing

@elyracode/laravel gives the agent x-ray vision into your project. Three tools, each answering a different question: what's the data model, what's the API surface, and what are the conventions.

elyra install npm:@elyracode/laravel

The extension activates automatically when it detects laravel/framework in your composer.json. Non-Laravel projects never see the tools.

laravel_models — the entire data model in one call

Instead of reading twenty model files to understand the relationships:

23 Eloquent models found:

User (app/Models/User.php) hasMany: Post (via posts()) hasMany: Comment (via comments()) hasMany: Order (via orders()) belongsToMany: Role (via roles()) belongsToMany: Team (via teams()) hasOne: Profile (via profile()) fillable: name, email, password casts: email_verified_at (datetime), password (hashed) scopes: active, verified, admin traits: HasFactory, Notifiable, SoftDeletes

Post (app/Models/Post.php) belongsTo: User (via user()) belongsTo: Category (via category()) hasMany: Comment (via comments()) belongsToMany: Tag (via tags()) fillable: title, body, slug, published_at, category_id, user_id casts: published_at (datetime), metadata (array) scopes: published, draft traits: HasFactory, HasSlug, SoftDeletes

Order (app/Models/Order.php) belongsTo: User (via user()) hasMany: OrderItem (via items()) morphMany: Payment (via payments()) fillable: user_id, status, total, currency casts: total (decimal:2), status (OrderStatus) traits: HasFactory

The agent sees every relationship, every cast, every scope, every trait. When it needs to add a Comment model, it already knows that Post has a comments() relationship, that the project uses HasSlug as a trait, and that SoftDeletes is the convention.

One tool call. Zero file reads. The data model that would have cost 15,000 tokens to discover by reading files costs 800.

laravel_routes — the full request lifecycle

47 routes:

GET /api/posts name: posts.index action: App\Http\Controllers\PostController@index middleware: api, auth:sanctum

POST /api/posts name: posts.store action: App\Http\Controllers\PostController@store middleware: api, auth:sanctum

GET /api/posts/{post} name: posts.show action: App\Http\Controllers\PostController@show middleware: api, auth:sanctum

DELETE /api/posts/{post} name: posts.destroy action: App\Http\Controllers\PostController@destroy middleware: api, auth:sanctum, can:delete,post

Not just routes — middleware chains, controller bindings, named routes. The agent sees that auth:sanctum is the standard, that delete routes use policy authorization via can:delete,post, and that the naming convention is resource.action.

Filter by prefix to focus on what matters:

Show me the admin routes
→ laravel_routes(prefix: "admin")

laravel_analyze — the architecture at a glance

Stack: Laravel v13.1.0 + Livewire + Tailwind + Alpine.js
Auth: Sanctum
Queue: redis
Cache: redis
Database: mysql
Patterns: Action classes (app/Actions/), Enums (app/Enums/), Events (app/Events/), Jobs (app/Jobs/)
Controllers: primarily invokable (single-action)
Models: 23
Migrations: 47
Factories: 19
Missing factories: Payment, AuditLog, Setting, Notification
Tests: 142 files (Pest)
Pending migrations: 2

The agent now knows: this project uses actions, not services. Controllers are invokable. Tests use Pest. Four models are missing factories. Two migrations haven't been run yet.

When you ask "add a comments feature," the agent generates:

  • A migration (following the existing naming conventions)

  • A Comment model with the right relationships and a factory

  • A CreateComment action (not a service, not a fat controller — because that's what the project uses)

  • A StoreCommentRequest for validation

  • An invokable StoreCommentController (not a resource controller)

  • Routes with auth:sanctum middleware

  • A CommentPolicy

  • A Pest test file

Every piece matches the project's conventions. Not because the agent is smart about Laravel — because it looked first.

A complete Laravel toolkit

@elyracode/laravel joins a family of Laravel-specific extensions that each handle a different part of the stack:

Extension What it does

  • @elyracode/laravel Project understanding — models, routes, architecture analysis

  • @elyracode/stack-tall TALL stack knowledge — Livewire 4, Flux UI, Alpine.js, Tailwind

  • @elyracode/stack-vilt VILT stack knowledge — Vue 3, Inertia.js, Laravel, Tailwind

  • @elyracode/stack-rilt RILT stack knowledge — React 19, Inertia.js 2, Laravel, shadcn/ui

  • @elyracode/stack-filament Filament v5 — admin panels, CRUD, tables, forms

  • @elyracode/stack-laravel-ai Laravel AI SDK — agents, sub-agents, embeddings

  • @elyracode/laravel-starters Starter kits from GitHub for bootstrapping projects

  • @elyracode/flux-ui Flux UI — component index, Blade converter, page generation

  • @elyracode/herd Laravel Herd — services, logs, PHP version, .env sync

  • @elyracode/db-tools Database — MySQL, ClickHouse, SQLite, schema discovery

Install the ones that match your stack. They all work together — the laravel extension understands your architecture, and the stack extensions give the agent deep knowledge of your specific tools.

For a TALL stack project:

elyra install npm:@elyracode/laravel
elyra install npm:@elyracode/stack-tall
elyra install npm:@elyracode/flux-ui

The agent now understands your data model (via laravel), knows Livewire 4 component patterns (via stack-tall), and can generate Flux UI components (via flux-ui). Ask it to "add a comments section to the post page" and it generates a Livewire component with Flux UI markup that matches both your data model and your frontend stack.

The difference in practice

Here's a real task: "Add user notifications with email and database channels."

Without @elyracode/laravel — typical agent behavior:

The agent reads User.php to check for existing notification traits. Reads three controller files to understand the pattern. Reads routes/api.php. Reads two existing notification classes to understand the format. Makes assumptions about the queue driver. Generates a notification with PHPUnit tests (the project uses Pest). Uses a service class (the project uses actions). Puts the controller in the wrong namespace.

Token cost: ~18,000. Three things need manual fixing.

With @elyracode/laravel:

The agent calls laravel_analyze() — sees Actions pattern, Pest tests, redis queue, Sanctum auth. Calls laravel_models(filter: "User") — sees existing traits, relationships, and that Notifiable is already there. Generates: migration, DatabaseNotification model, SendUserNotification action, NotificationController (invokable), routes with correct middleware, Pest tests.

Token cost: ~5,000. Nothing needs fixing.

Get it

elyra update
elyra install npm:@elyracode/laravel

Then ask: "analyze this project" or "show me the models." The agent does the rest.


Elyra v0.7.12 — changelog