AI Generative Engine Optimization for Laravel

Last updated on by

AI Generative Engine Optimization for Laravel image

If you've been thinking about how your products show up in AI-generated answers, laravel-aigeo by Hitesh Zope is worth a look. It brings Generative Engine Optimization (GEO) tooling directly into your Laravel app, giving you structured metadata, AI-readable feeds, and an audit dashboard without a lot of glue code.

The HasGeoProfile Trait

The entry point is the HasGeoProfile trait, which you add to any Eloquent model you want visible to AI crawlers — a product, an article, a listing. You define a geoProfile() method that maps your model's fields to the schema the package uses for JSON-LD injection:

use Hszope\LaravelAigeo\Traits\HasGeoProfile;
 
class Product extends Model
{
use HasGeoProfile;
 
public function geoProfile(): array
{
return [
'name' => $this->name,
'description' => $this->description,
'price' => $this->price,
'sku' => $this->sku,
'image' => $this->image_url,
'url' => url("/products/{$this->id}"),
'rating' => $this->average_rating ?? null,
'review_count' => $this->review_count ?? null,
'currency' => 'USD',
'in_stock' => true,
'attributes' => [
'Brand' => $this->brand->name,
],
];
}
}

Once the trait is in place, the package knows how to pull structured data from that model for schema generation and feed output.

Injecting JSON-LD with a Blade Component

With your model ready, you drop the <x-geo-head> component into your layout's <head>. It handles generating and injecting the JSON-LD <script> tag for that page:

<head>
<x-geo-head :model="$product" />
</head>

The output is a structured JSON-LD block that describes your content in a format LLMs can parse when crawling your site.

llms.txt and the AI Product Feed

Two scheduled Artisan commands keep your AI-crawler-facing files up to date. The geo:llms-txt command generates a llms.txt file — a plain-text index that guides AI crawlers through your site's content. The geo:feed command outputs an ai-product-feed.json — a JSON feed structured specifically for LLM indexing rather than traditional RSS or sitemap formats.

Wire them up in your schedule:

use Illuminate\Support\Facades\Schedule;
 
Schedule::command('geo:llms-txt')->daily();
Schedule::command('geo:feed')->daily();

GEO Scoring Dashboard

The package ships with a dashboard at /geo that gives each of your registered models a 0–100 score based on AI-signal completeness — things like whether descriptions are filled in, schema fields are present, and citation-worthy data exists. You configure which models appear in the audit view via config/geo.php:

'dashboard' => [
'enabled' => true,
'path' => '/geo',
'middleware' => ['web', 'auth'],
 
'models' => [
['model' => \App\Models\Product::class, 'label' => 'Products'],
['model' => \App\Models\Article::class, 'label' => 'Articles'],
],
],

Make sure to lock this down with auth or your admin middleware before deploying.

You can find the full source and documentation on GitHub.

Paul Redmond photo

Staff writer at Laravel News. Full stack web developer and author.

Cube

Laravel Newsletter

Join 40k+ other developers and never miss out on new tips, tutorials, and more.

image
Acquaint Softtech

Hire Laravel developers with AI expertise at $20/hr. Get started in 48 hours.

Visit Acquaint Softtech
Lucky Media logo

Lucky Media

Get Lucky Now - the ideal choice for Laravel Development, with over a decade of experience!

Lucky Media
SaaSykit: Laravel SaaS Starter Kit logo

SaaSykit: Laravel SaaS Starter Kit

SaaSykit is a Multi-tenant Laravel SaaS Starter Kit that comes with all features required to run a modern SaaS. Payments, Beautiful Checkout, Admin Panel, User dashboard, Auth, Ready Components, Stats, Blog, Docs and more.

SaaSykit: Laravel SaaS Starter Kit
Acquaint Softtech logo

Acquaint Softtech

Acquaint Softtech offers AI-ready Laravel developers who onboard in 48 hours at $3000/Month with no lengthy sales process and a 100 percent money-back guarantee.

Acquaint Softtech
No Compromises logo

No Compromises

Joel and Aaron, the two seasoned devs from the No Compromises podcast, are now available to hire for your Laravel project. ⬧ Flat rate of $9500/mo. ⬧ No lengthy sales process. ⬧ No contracts. ⬧ 100% money back guarantee.

No Compromises
Harpoon: Next generation time tracking and invoicing logo

Harpoon: Next generation time tracking and invoicing

The next generation time-tracking and billing software that helps your agency plan and forecast a profitable future.

Harpoon: Next generation time tracking and invoicing
Shift logo

Shift

Running an old Laravel version? Instant, automated Laravel upgrades and code modernization to keep your applications fresh.

Shift
PhpStorm logo

PhpStorm

The go-to PHP IDE with extensive out-of-the-box support for Laravel and its ecosystem.

PhpStorm
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Tinkerwell logo

Tinkerwell

The must-have code runner for Laravel developers. Tinker with AI, autocompletion and instant feedback on local and production environments.

Tinkerwell
Laravel Cloud logo

Laravel Cloud

Easily create and manage your servers and deploy your Laravel applications in seconds.

Laravel Cloud

The latest

View all →
Laravel Quota: Usage Budgets for Calendar Periods image

Laravel Quota: Usage Budgets for Calendar Periods

Read article
Find the Security Vulnerabilities in Your Laravel App with Sensagraph image

Find the Security Vulnerabilities in Your Laravel App with Sensagraph

Read article
Uvora: A macOS Menu Bar App for Finding Laravel Projects image

Uvora: A macOS Menu Bar App for Finding Laravel Projects

Read article
Passwordless Sign-In with Fortify Two-Factor Support in Laravel image

Passwordless Sign-In with Fortify Two-Factor Support in Laravel

Read article
Intercept: Middleware Guardrails for Laravel AI Agents image

Intercept: Middleware Guardrails for Laravel AI Agents

Read article
AI Review for Laravel Upgrades image

AI Review for Laravel Upgrades

Read article