Polyscope - The agent-first dev environment for Laravel

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
Laravel Cloud

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

Visit Laravel Cloud
Laravel Cloud logo

Laravel Cloud

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

Laravel Cloud
SerpApi logo

SerpApi

Access real-time search engine results through a simple API—no more scraping headaches! Use it for AI applications, SEO tools, product research, travel information, and more

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

Tinkerwell

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

Tinkerwell
Kirschbaum logo

Kirschbaum

Providing innovation and stability to ensure your web application succeeds.

Kirschbaum
Shift logo

Shift

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

Shift
Get expert guidance in a few days with a Laravel code review logo

Get expert guidance in a few days with a Laravel code review

Expert code review! Get clear, practical feedback from two Laravel devs with 10+ years of experience helping teams build better apps.

Get expert guidance in a few days with a Laravel code review
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 →
Laravel Installer Now Returns JSON When Running Inside an AI Agent image

Laravel Installer Now Returns JSON When Running Inside an AI Agent

Read article
Queue-Wide Inspection Methods in Laravel 13.8.0 image

Queue-Wide Inspection Methods in Laravel 13.8.0

Read article
Verifiable Audit Logging with Laravel Chronicle image

Verifiable Audit Logging with Laravel Chronicle

Read article
Ship AI with Laravel: Search Entire PDFs with Zero Search Logic image

Ship AI with Laravel: Search Entire PDFs with Zero Search Logic

Read article
Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB image

Personalized Content Delivery System: Building an AI-powered recommendation engine with Laravel and MongoDB

Read article
Laravel Brain: Visualize Your Application's Request Lifecycle image

Laravel Brain: Visualize Your Application's Request Lifecycle

Read article