How spatie/laravel-sitemap works
Main Components Identification
The system should be represented with these key components:
a. Core Components:
• SitemapGenerator (Central orchestrator)
• Sitemap (Base sitemap handler)
• SitemapIndex (Index handler)
• Crawler System (URL discovery and processing)
• Tag System (URL, Image, Video, News handlers)
b. External Integrations:
• Laravel Framework
• Filesystem Interface
• Headless Chrome (for JavaScript execution)
• HTTP Client (Guzzle)
Top Layer: Entry Points
Middle Layer: Core Services
Bottom Layer: Storage & External Services
Component Relationships
a. Entry Points:
• How SitemapGenerator can be accessed via Laravel's service provider
• Command-line interface for scheduled generation
b. Core Processing Flow:
• SitemapGenerator → Crawler → URL Discovery
• URL Processing → Tag System → XML Generation
• Sitemap/SitemapIndex → Storage Interface
Specific Implementation Details
Key architectural patterns:
a. Service Layer:
• SitemapServiceProvider as the entry point
• Configuration injection system
b. Contract/Interface Layer:
• Sitemapable interface implementation
• Crawler profiles system
c. Tag System:
• Inheritance hierarchy for different tag types (URL, Image, Video, News)
Key Processes to Highlight
a. Sitemap Generation Flow:
URL Input → Crawler → URL Discovery → Tag Generation → XML Output
b. Custom Implementation Flow:
Model → Sitemapable Interface → Tag Generation → Sitemap Integration
Important Notes
• Flexibility of the crawler configuration
• Multiple output options (file/disk storage)
• JavaScript execution capability
• Index generation process