定制 hszope/laravel-aigeo 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

hszope/laravel-aigeo

Composer 安装命令:

composer require hszope/laravel-aigeo

包简介

Generative Engine Optimization (GEO) for Laravel — get your products surfaced inside AI-generated answers from ChatGPT, Gemini, Perplexity and more.

README 文档

README

Generative Engine Optimization (GEO) for Laravel. Get your products surfaced inside AI-generated answers from ChatGPT, Gemini, Perplexity, Claude, and Bing AI.

Why GEO matters in 2026

Search is shifting from a list of blue links to direct, generated answers. AI answer engines (ChatGPT, Google Overviews, Perplexity) are becoming the primary discovery tool for users. If your content isn't optimized for these engines, you don't exist in the AI-first world.

Features

  1. llms.txt Generation: Automatically creates and serves llms.txt to guide AI crawlers.
  2. Rich JSON-LD Schema: Injects semantic metadata into your pages to help LLMs understand your products perfectly.
  3. GEO Scoring: Audit your products with a 0-100 score based on AI-critical signals.
  4. Citation Enrichment: Automatically adds stat-rich, citation-worthy data.
  5. AI Product Feed: Serves a specialized JSON feed designed specifically for LLM indexing.
  6. Visual Dashboard: A beautiful, premium interface to manage and audit your GEO performance.
  7. Blade Components: Simple tools to integrate GEO features into your existing views.

Dashboard Preview

Overview

Requirements

  • PHP 8.2+
  • Laravel 10, 11, or 12

Installation

composer require hszope/laravel-aigeo

Publish the config, migrations, and assets:

php artisan vendor:publish --tag="laravel-aigeo-config"
php artisan vendor:publish --tag="laravel-aigeo-migrations"
php artisan migrate

Quick Start

1. Add the Trait

Add the HasGeoProfile trait to any Model you want surfaced to AI (e.g. Product, Article, User).

use Hszope\LaravelAigeo\Traits\HasGeoProfile;

class Product extends Model
{
    use HasGeoProfile;

    // Map your database fields to the AI schema
    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,
            ],
        ];
    }
}

2. Inject the AI Schema

Add the <x-geo-head> component to your layout's <head>. This will automatically inject highly optimized JSON-LD scripts on your product pages.

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

3. Setup Scheduled AI Feeds

To keep your llms.txt and ai-product-feed.json updated automatically for AI crawlers, add the following commands to your Laravel schedule (usually in routes/console.php or app/Console/Kernel.php):

use Illuminate\Support\Facades\Schedule;

Schedule::command('geo:llms-txt')->daily();
Schedule::command('geo:feed')->daily();

Securing the Dashboard

The package comes with a built-in dashboard accessible at /geo. By default, you should protect this route using Laravel middleware.

Open config/geo.php and configure your middleware and models:

'dashboard' => [
    'enabled'    => true,
    'path'       => '/geo',
    'middleware' => ['web', 'auth'], // Add 'auth' or your custom admin middleware here
    
    // Which models should show up in your Audit page?
    'models' => [
        ['model' => \App\Models\Product::class, 'label' => 'Products'],
        ['model' => \App\Models\Article::class, 'label' => 'Articles'],
    ],
],

Testing

composer test

License

The MIT License (MIT). Please see License File for more information.

统计信息

  • 总下载量: 870
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 54
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 54
  • Watchers: 0
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-04-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固