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
Tinkerwell

Enjoy coding and debugging in an editor designed for fast feedback and quick iterations. It's like a shell for your application – but with multi-line editing, code completion, and more.

Visit Tinkerwell
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
Lucky Media logo

Lucky Media

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

Lucky Media
Shift logo

Shift

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

Shift
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
Tinkerwell logo

Tinkerwell

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

Tinkerwell
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
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
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
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
PhpStorm logo

PhpStorm

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

PhpStorm

The latest

View all →
Monitor and Control Schedules, Queues, and Errors in Laravel with Watchtower image

Monitor and Control Schedules, Queues, and Errors in Laravel with Watchtower

Read article
Showcase Your PhpStorm Expertise on LinkedIn image

Showcase Your PhpStorm Expertise on LinkedIn

Read article
Privacy Filter: Detect PII in Text from Laravel image

Privacy Filter: Detect PII in Text from Laravel

Read article
NationForge: A Self-Hosted Admin Panel for Civic Organizations image

NationForge: A Self-Hosted Admin Panel for Civic Organizations

Read article
Monitor Laravel Queues, Commands, and Schedulers on Any Driver with Vigilance image

Monitor Laravel Queues, Commands, and Schedulers on Any Driver with Vigilance

Read article
Watch the Teaser for 'The Story of PHP' Documentary image

Watch the Teaser for 'The Story of PHP' Documentary

Read article