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
| Class | Purpose |
|---|---|
SitemapUrl | Represents a single URL entry |
SitemapEntry | Complete sitemap entry with metadata |
Value Objects
| Class | Purpose |
|---|---|
Priority | Validated priority value (0.0-1.0) |
ChangeFrequency | Valid change frequency enum |
Interfaces
| Interface | Purpose |
|---|---|
UrlProviderInterface | Contract for URL providers |
CacheInterface | Contract for caching |
RendererInterface | Contract for XML rendering |
Application Layer
Orchestrates the domain logic and coordinates between layers.
| Class | Purpose |
|---|---|
SitemapGenerator | Coordinates sitemap generation |
ConfigurationService | Manages plugin settings |
Kernel | Application bootstrap and DI |
Infrastructure Layer
Concrete implementations of domain interfaces.
URL Providers
| Provider | Content |
|---|---|
PostUrlProvider | Blog posts |
PageUrlProvider | Static pages |
ProductUrlProvider | WooCommerce products |
TaxonomyUrlProvider | Categories, tags |
AuthorUrlProvider | Author archives |
Support Classes
| Class | Purpose |
|---|---|
TransientCache | WordPress transients implementation |
XmlRenderer | XML sitemap generation |
WP Layer
WordPress-specific integration code.
| Class | Purpose |
|---|---|
AdminMenu | Admin menu registration |
SitemapController | Handles sitemap requests |
SettingsController | Admin settings handling |
DashboardPage | Dashboard admin page |
SettingsPage | Settings admin page |
AdvancedPage | Advanced admin page |
HelpPage | Help 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/
