Documentation → Developer Resources

Architecture Overview

Four-layer clean architecture design for maintainability and extensibility.

Design Principles

Developer Sitemap follows clean architecture principles to ensure maintainability, testability, and extensibility:

  • Separation of Concerns — Each layer has a specific responsibility
  • Dependency Inversion — High-level modules don’t depend on low-level modules
  • Open-Closed Principle — Open for extension, closed for modification
  • Single Responsibility — Each class has one reason to change

Layer Structure

The plugin is organized into four distinct layers, with dependencies flowing inward:

┌─────────────────────────────────────────┐
│              WP Layer                    │  ← WordPress Integration
│  (Hooks, Admin UI, REST, CLI)           │
├─────────────────────────────────────────┤
│         Infrastructure Layer             │  ← Concrete Implementations
│  (URL Providers, Cache, XML Renderer)   │
├─────────────────────────────────────────┤
│          Application Layer               │  ← Orchestration
│  (Sitemap Generator, Config Service)    │
├─────────────────────────────────────────┤
│            Domain Layer                  │  ← Pure PHP (No WordPress)
│  (Entities, Value Objects, Interfaces)  │
└─────────────────────────────────────────┘

Domain Layer

The innermost layer contains pure PHP with no WordPress dependencies. This makes the core logic testable and portable.

Entities

ClassPurpose
SitemapUrlRepresents a single URL entry
SitemapEntryComplete sitemap entry with metadata

Value Objects

ClassPurpose
PriorityValidated priority value (0.0-1.0)
ChangeFrequencyValid change frequency enum

Interfaces

InterfacePurpose
UrlProviderInterfaceContract for URL providers
CacheInterfaceContract for caching
RendererInterfaceContract for XML rendering

Application Layer

Orchestrates the domain logic and coordinates between layers.

ClassPurpose
SitemapGeneratorCoordinates sitemap generation
ConfigurationServiceManages plugin settings
KernelApplication bootstrap and DI

Infrastructure Layer

Concrete implementations of domain interfaces.

URL Providers

ProviderContent
PostUrlProviderBlog posts
PageUrlProviderStatic pages
ProductUrlProviderWooCommerce products
TaxonomyUrlProviderCategories, tags
AuthorUrlProviderAuthor archives

Support Classes

ClassPurpose
TransientCacheWordPress transients implementation
XmlRendererXML sitemap generation

WP Layer

WordPress-specific integration code.

ClassPurpose
AdminMenuAdmin menu registration
SitemapControllerHandles sitemap requests
SettingsControllerAdmin settings handling
DashboardPageDashboard admin page
SettingsPageSettings admin page
AdvancedPageAdvanced admin page
HelpPageHelp admin page

Directory Structure

developer-sitemap/
├── developer-sitemap.php    # Bootstrap
├── uninstall.php            # Cleanup
├── src/
│   ├── Domain/
│   │   ├── Entity/
│   │   ├── ValueObject/
│   │   └── Interface/
│   ├── Application/
│   │   └── Service/
│   ├── Infrastructure/
│   │   ├── Provider/
│   │   ├── Cache/
│   │   └── Renderer/
│   └── WP/
│       ├── Admin/
│       └── Controller/
├── tests/
│   ├── unit/
│   └── integration/
└── docs/