KMP (Kingdom Management Portal) Developer Documentation
Table of Contents
| Section | Description |
|---|---|
| 1. Introduction | |
| 1.1 About KMP | Overview of the Kingdom Management Portal project |
| 1.2 Project Purpose | Membership management system for SCA Kingdoms |
| 1.3 System Requirements | PHP 8.3+, MySQL/MariaDB, etc. |
| 2. Getting Started | |
| 2.1 Installation | Setting up development environment |
| 2.2 Configuration | NEW Application configuration overview |
| 2.3 CakePHP Basics | Brief overview of CakePHP framework |
| 3. Architecture | |
| 3.1 Core Foundation Architecture | Application bootstrap, middleware stack, security architecture |
| 3.2 Model Behaviors | ActiveWindow, JsonField, and Sortable behaviors |
| 3.3 Database Schema | Complete database schema documentation |
| 3.4 Migration Documentation | Database migration history and patterns |
| 3.5 ER Diagrams | Entity relationship diagrams |
| 3.6 Seed Documentation | Data seeding framework and patterns |
| 3.7 Active Window Sync | Scheduled status maintenance for ActiveWindow entities |
| 3.8 Youth Age-Up | Automated transition of minor accounts to adult statuses |
| 4. Core Modules | |
| 4.1 Member Lifecycle | Complete member lifecycle and data flow documentation |
| 4.1.1 MembersTable API Reference | MembersTable model API and query methods |
| 4.2 Branch Hierarchy | Complete organizational structure and tree management documentation |
| 4.3 Warrant Lifecycle | Complete warrant state machine and approval process documentation |
| 4.4 RBAC Security Architecture | Complete RBAC system with warrant temporal validation layer |
| 4.5 View Patterns | Template system, helpers, and UI components |
| 4.6 Gatherings System | Event management, calendar views, and attendance tracking |
| 4.6.1 Calendar Download Feature | iCalendar (.ics) file generation for importing events |
| 4.6.2 Gathering Staff Management | Staff and steward management system |
| 4.6.3 Gathering Schedule System | Timetables and scheduled activities for events |
| 4.6.4 Waiver Exemption System | Attestation system for waiver exemptions |
| 4.7 Document Management & Retention System | File uploads, storage, and retention policies |
| 4.9 Impersonation Mode | Super user impersonation for troubleshooting with audit trail |
| 5. Plugins | |
| 5.1 Officers Plugin | Officers management and roster system |
| 5.1.1 Officers Services | Officers plugin service layer reference |
| 5.2 Awards Plugin | Award recommendations and management system |
| 5.2.1 EventsTable API | Awards EventsTable model reference |
| 5.2.2 LevelsTable API | Awards LevelsTable model reference |
| 5.2.3 RecommendationsStatesLogsTable API | Awards recommendation state logs model reference |
| 5.2.4 RecommendationsTable API | Awards RecommendationsTable model reference |
| 5.2.5 Award Policy | Award entity authorization policy |
| 5.2.6 AwardsTable Policy | Awards table-level authorization policy |
| 5.2.7 Domain Policy | Awards domain entity authorization policy |
| 5.2.8 DomainsTable Policy | Awards domains table authorization policy |
| 5.2.9 Event Policy | Awards event entity authorization policy |
| 5.2.10 EventsTable Policy | Awards events table authorization policy |
| 5.2.11 Level Policy | Awards level entity authorization policy |
| 5.2.12 LevelsTable Policy | Awards levels table authorization policy |
| 5.2.13 Recommendation Policy | Awards recommendation entity authorization policy |
| 5.2.14 RecommendationsStatesLog Policy | Recommendation state log authorization policy |
| 5.2.15 RecommendationsStatesLogTable Policy | Recommendation state log table authorization policy |
| 5.2.16 RecommendationsTable Policy | Recommendations table authorization policy |
| 5.2.17 Awards Services | Awards plugin service layer reference |
| 5.3 Queue Plugin | Background job processing system |
| 5.4 GitHubIssueSubmitter Plugin | User feedback submission to GitHub |
| 5.5 Bootstrap Plugin | UI framework integration |
| 5.6 Activities Plugin | Comprehensive authorization management system |
| Activities Quick Reference | Activities plugin quick reference card |
| Activities Documentation Refactoring | Documentation refactoring summary for Activities plugin |
| 5.6.1 Plugin Architecture | Activities plugin architecture and configuration |
| 5.6.2 Activities Controller | Activities controller reference |
| 5.6.3 Activity Groups Controller | Activity groups controller reference |
| 5.6.4 Activity Entity | Activity entity reference |
| 5.6.5 Security Patterns | Activity authorization and security patterns |
| 5.6.6 Activity Groups Entity | Activity groups entity reference |
| 5.6.7 Authorization Entity | Authorization entity reference |
| 5.6.8 AuthorizationApproval Entity | AuthorizationApproval entity reference |
| 5.7 Waivers Plugin | Waiver upload, tracking, and compliance management |
| 6. Services | Service layer architecture — WarrantManager, ActiveWindowManager, Email, Navigation, CSV export, authorization, calendar, retention, and more |
| 6.2 Authorization Helpers | getBranchIdsForAction() and permission helper methods |
| 6.3 Email Template Management | Database-driven email template system with WYSIWYG editor |
| 6.4 Caching Strategy | NEW Multi-tier caching architecture and performance tuning |
| 7. Development Workflow | |
| 7.1 Security Best Practices | Security configuration, testing, and audit findings |
| 7.2 Coding Standards | PHP and JavaScript coding standards |
| 7.3 Testing Infrastructure | Test super user fixtures, authentication helpers, and testing best practices |
| 7.4 Security Debug Information | Authorization tracking and debug display for development |
| 7.5 Git Workflow | Version control workflow |
| 7.6 Testing Suite Overview | PHPUnit suite structure, seed management, and run commands |
| 7.7 Console Commands | CLI console commands reference for CakePHP shell tasks |
| 7.8 Performance Sizing & Risk Monitoring | Benchmark workflow, installer sizing guidance, and performance risk detection |
| 8. Deployment | |
| 8.1 Environment Setup | NEW Environment variables reference and configuration |
| 8.2 Migrations | Database migration handling |
| 8.3 Updates | Application update procedures |
| 9. UI Components | |
| 9.1 Dataverse Grid System | Modern data table system with views, filters, sorting, and export |
| 9.2 Bootstrap Icons | NEW Bootstrap Icons integration and usage |
| 9.3 Dataverse Grid Complete Guide | NEW Comprehensive DV Grid implementation reference |
| 9.3 Layouts | Template layouts and structure |
| 9.4 View Helpers | Custom view helpers |
| 9.5 Frontend Libraries | JavaScript and CSS libraries |
| 10. JavaScript Development | |
| 10.1 JavaScript Framework | Detailed Stimulus.JS framework implementation |
| 10.2 QR Code Controller | QR code generation with Stimulus and npm packages |
| 10.3 Timezone Handling | Timezone conversion, display, and storage patterns |
| 10.3.1 Timezone Utility API | KMP_Timezone utility API reference |
| 10.3.2 Timezone Input Controller | Timezone input Stimulus controller reference |
| 10.4 Asset Management | NEW Asset compilation, versioning, and optimization |
| 11. Extending KMP | |
| 11.1 Creating Plugins | How to create plugins for extending KMP |
| 11.2 Navigation and Event System | How to add Navigation from a plugin and inject Plugin UI into Core Pages |
| 11.3 Creating UI Components | Extending the UI with custom cells |
| 11.4 Database Models | Adding custom database models to plugins |
| 11.5 Best Practices | Guidelines for effective plugin development |
| 11.6 Managing Plugin Configuration | Using AppSettings for plugin configuration |
| 11.7 Adding Public IDs to Plugin Tables | Implementing secure public identifiers in plugins |
| 11.8 Creating REST API Endpoints | API controllers, routes, authentication, and authorization |
| 11.9 OpenAPI Documentation for Plugin APIs | Plugin spec fragments and Swagger UI |
| 11.10 Injecting Data into Other API Responses | ApiDataRegistry pattern for cross-plugin data enrichment |
API Documentation
| Reference | Description |
|---|---|
| API Reference Portal | REST API quick start, Swagger UI, and developer guides |
| PHP API Reference | Controllers, Services, Models, Behaviors, and Plugins |
| JavaScript API Reference | Stimulus controllers, utilities, and frontend modules |
Appendices
| Section | Description |
|---|---|
| Appendices | |
| A. Troubleshooting | Common issues and solutions |
| B. Glossary | Terms specific to KMP and SCA |
| C. Resources | Additional resources and references |
Supplemental Documentation
| Document | Description |
|---|---|
| Docker Development | Docker multi-container setup for local and hosted development |
| Office Reporting Structure | Hierarchical reporting relationships between offices |
| Documentation Migration Summary | Summary of documentation migration efforts |
| Activity Groups Controller Migration | ActivityGroupsController documentation migration notes |
| Dataverse Grid Filter Audit | Custom filter handler candidates audit |
| Dataverse Grid Migration Todo | Dataverse grid migration work-in-progress tracker |
| System Views Refactor Task List | DVTables system views refactor tasks |
| License | Project license information |
Quick Start Guide
For developers new to KMP:
- Start with Getting Started to set up your development environment
- Review Architecture to understand the system structure
- Explore Core Modules to learn about the main functionality
- Check Development Workflow for coding standards and practices
- For configuration questions, see Configuration and Environment Setup
Recent Documentation Updates
December 2025 - Configuration Documentation Migration
The following documentation has been newly created or significantly expanded:
- ✅ 2-configuration.md - Comprehensive application configuration guide
- ✅ 8.1-environment-setup.md - Environment variables reference (complete)
- ✅ 6.4-caching-strategy.md - Multi-tier caching strategy and tuning
- ✅ 10.4-asset-management.md - Asset compilation and optimization
- ✅ 9.2-bootstrap-icons.md - Bootstrap Icons integration
- ✅ 7.1-security-best-practices.md - Expanded with session and encryption docs
- ✅ 4.7-document-management-system.md - Expanded with storage configuration
- ✅ app/config/app.php - Cleaned up, reduced documentation bloat by 45%
See DOCUMENTATION_MIGRATION_SUMMARY.md for complete details on the migration.
Documentation Status
This documentation is actively maintained and reflects the current state of the KMP codebase.
Contributing
When contributing to KMP, please:
- Follow the coding standards outlined in Development Workflow
- Update relevant documentation when making changes
- Run tests before submitting changes
- Review the Plugin Development Guide when creating extensions
Support
- Issues: Report issues through the GitHub repository
- Documentation: This comprehensive developer documentation
- Code Examples: See individual sections for implementation examples