Agent-readable documentation for every Core subsystem, extracted from 530 PHP source files. Each CLAUDE.md documents key classes, public API, patterns, and integration points. Highlights discovered: - Actions: #[Scheduled] attribute system wires to Laravel scheduler - Bouncer Gate: training mode with #[Action] attributes (CoreGO pattern) - Config: hierarchical scope (global→workspace→user) with version diffs - Crypt: LthnHash = QuasiSalt from dAppServer, ported to PHP - Database: Kahn's algorithm topological seeder sorting via attributes - Events: 12 lifecycle events with HasEventVersion forward compat - Front: 78 blade components + programmatic Component for MCP/agent UI - Headers: DetectDevice identifies 14 in-app browser platforms - Input: 9-step pre-boot sanitisation pipeline - Lang: TranslationMemory with fuzzy matching + TMX import/export - Mail: EmailShield with 100k+ disposable domain blocking - Search: 7-source unified search with privacy-aware IP hashing - Storage: Redis circuit breaker (Closed/Open/Half-Open) Co-Authored-By: Virgil <virgil@lethean.io>
3.1 KiB
3.1 KiB
Core\Seo
SEO metadata management, JSON-LD schema generation, structured data validation, OG image handling, and score trend tracking.
Key Classes
| Class | Purpose |
|---|---|
Schema |
High-level JSON-LD generator: auto-detects Article, HowTo, FAQ, Breadcrumb from content |
SeoMetadata |
Eloquent model (polymorphic): title, description, canonical, OG, Twitter, schema markup, score, issues |
HasSeoMetadata |
Trait for models: seoMetadata() morphOne, updateSeo(), getSeoHeadTagsAttribute() |
Boot |
Service provider: registers singletons + artisan commands |
Services/
| Class | Purpose |
|---|---|
SchemaBuilderService |
Lower-level schema building blocks |
ServiceOgImageService |
OG image generation for service pages |
Validation/
| Class | Purpose |
|---|---|
SchemaValidator |
Validates schema against schema.org specifications |
StructuredDataTester |
Tests structured data, checks rich results eligibility, generates reports |
CanonicalUrlValidator |
Validates URL format and detects conflicts between records |
OgImageValidator |
Validates OG image dimensions and requirements |
Analytics/
| Class | Purpose |
|---|---|
SeoScoreTrend |
Daily/weekly score trend tracking |
Models\SeoScoreHistory |
Historical score records |
Schema Generation
Schema::generateSchema($item) builds a @graph containing:
- Organisation schema (always, from config)
- Article schema (TechArticle by default)
- Breadcrumb schema
- HowTo schema (if content has numbered steps)
- FAQ schema (if content has FAQ section with Q&A pairs)
Content detection uses regex on display_content. Steps extracted from JSON blocks or numbered lists. FAQs from ## FAQ sections.
SeoMetadata Model
- Lazy schema_markup: Custom accessor/mutator defers JSON parsing until accessed
- Meta tag generation:
meta_tagsattribute produces complete HTML<title>,<meta>,<link rel="canonical">, OG, Twitter tags - JSON-LD output:
json_ldattribute wraps schema in<script type="application/ld+json">with XSS-safeJSON_HEX_TAG - Score tracking:
recordScore(),getScoreHistory(),getDailyScoreTrend(),hasScoreImproved() - Validation:
validateOgImage(),validateCanonicalUrl(),checkCanonicalConflict(),validateStructuredData(),getRichResultsEligibility()
Console Commands
seo:record-scores-- Record SEO scores for trend trackingseo:test-structured-data-- Test structured data against schema.orgseo:audit-canonical-- Audit canonical URLs for conflictsseo:generate-og-images-- Generate OG images for services
Configuration
Under config/seo.php:
trends.enabled,trends.retention_days,trends.record_on_save,trends.min_interval_hoursstructured_data.external_validation,structured_data.google_api_key,structured_data.cache_validation
Integration
- Use
HasSeoMetadatatrait on any Eloquent model to add polymorphic SEO data Schemareads organisation config fromcore.organisation.*andcore.social.*- Uses UK English in code:
colour,organisation