responsive-sk / hdm-boot
HDM Boot - Hexagonal + DDD + Modular Monolith Architecture Framework
Installs: 3
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 1
Type:project
Requires
- php: ^8.3
- cakephp/database: ^5.2
- cakephp/validation: ^5.2
- firebase/php-jwt: ^6.8
- monolog/monolog: ^3.9
- php-di/php-di: ^7.0
- ramsey/uuid: ^4.7
- responsive-sk/slim4-paths: ^2.0
- responsive-sk/slim4-session: ^2.2.2
- slim/php-view: ^3.4
- slim/psr7: ^1.6
- slim/slim: ^4.12
- vlucas/phpdotenv: ^5.5
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.75
- phpstan/phpstan: ^2.1
- phpunit/phpunit: ^10.3
- squizlabs/php_codesniffer: ^3.7
This package is not auto-updated.
Last update: 2025-07-07 17:55:45 UTC
README
Enterprise PHP framework with Triple Architecture: Hexagonal + DDD + Modular Monolith
๐ Features
๐๏ธ Triple Architecture
- Hexagonal Architecture - Clean separation of business logic from infrastructure
- Domain-Driven Design - Rich domain models with clear boundaries
- Modular Monolith - Independent modules with clear interfaces
๐ Security First
- JWT Authentication - Secure token-based authentication
- CSRF Protection - Cross-site request forgery prevention
- Secure Sessions - Enterprise-grade session management
- Path Safety - Safe file system operations with
responsive-sk/slim4-paths
- Directory Protection -
.htaccess
protection for sensitive directories - Path Traversal Prevention - Secure path resolution with Paths service
๐ Internationalization
- Multi-language Support - Slovak, Czech, English, and more
- Automatic Detection - Browser and user preference detection
- Gettext Integration - Professional translation workflow
- Locale Management - Dynamic language switching
๐๏ธ Full Module Isolation
- Independent Modules - Each module can have its own composer.json
- Module-specific Testing - Isolated test suites with PHPUnit
- CI/CD per Module - GitHub Actions for individual modules
- Marketplace Ready - Open-source plugin ecosystem support
๐ Enterprise Ready
- Comprehensive Logging - Monolog with multiple handlers
- Health Monitoring - Multiple health check endpoints
- Database Abstraction - Multiple storage engines support
- Production Deployment - Complete deployment guides and validation
๐ฆ Installation
Quick Start
composer create-project responsive-sk/hdm-boot my-project cd my-project cp .env.example .env # Configure your .env file composer install
Development Setup
# Clone repository git clone https://github.com/responsive-sk/hdm-boot.git cd hdm-boot # Install dependencies composer install # Configure environment cp .env.example .env php bin/generate-keys.php # Validate environment php bin/validate-env.php # Fix permissions php bin/fix-permissions.php # Start development server php -S localhost:8000 -t public/
Production Deployment
# Build production package php bin/build-production.php # Upload generated ZIP to your server via FTP/FTPS # Extract files and configure .env # Visit your website to complete setup
๐ Complete deployment guide: docs/DEPLOYMENT_GUIDE.md
๐ Directory Structure
HDM Boot follows an organized directory structure with runtime data consolidated under var/
:
project/
โโโ var/ # Runtime data (protected)
โ โโโ storage/ # Database files
โ โ โโโ mark.db # Mark system database
โ โ โโโ user.db # User system database
โ โ โโโ system.db # Core system database
โ โโโ logs/ # Application logs
โ โโโ cache/ # Cache files
โ โโโ sessions/ # Session data
โโโ content/ # Content files (Git-friendly)
โ โโโ articles/ # Markdown articles
โ โโโ docs/ # Documentation
โโโ templates/ # Template files
โ โโโ layouts/
โ โโโ partials/
โโโ public/ # Web-accessible files only
โ โโโ assets/
โ โโโ media/
โโโ src/ # Application source code
โ โโโ Modules/
โ โโโ SharedKernel/
โโโ config/
โโโ paths.php # Path configuration
Key Benefits:
- Security - Sensitive files outside web root
- Organization - Clear separation of concerns
- Protection -
.htaccess
files protect sensitive directories - Flexibility - Configurable paths via
config/paths.php
๐ Paths Service Guide: docs/PATHS_SERVICE_GUIDE.md
๐๏ธ Architecture
HDM Boot implements Triple Architecture combining three enterprise patterns:
1. Hexagonal Architecture (Ports & Adapters)
Application Core
โโโ Domain/ # Business logic
โโโ Application/ # Use cases
โโโ Ports/ # Interfaces
Infrastructure
โโโ Adapters/ # External integrations
โโโ Persistence/ # Database implementations
โโโ Web/ # HTTP controllers
2. Domain-Driven Design (DDD)
Domain/
โโโ Entities/ # Business objects
โโโ ValueObjects/ # Immutable values
โโโ Repositories/ # Data access interfaces
โโโ Services/ # Domain services
โโโ Events/ # Domain events
3. Modular Monolith
src/Modules/
โโโ Core/ # Essential modules
โ โโโ User/ # User management
โ โโโ Security/ # Authentication & authorization
โ โโโ Template/ # View rendering
โ โโโ Session/ # Session management
โโโ Optional/ # Feature modules
โโโ Blog/ # Blog functionality (Full Module Isolation)
โโโ Ecommerce/ # E-commerce features
๐ง Configuration
Environment Variables
# Application APP_NAME="HDM Boot" APP_ENV=prod APP_DEBUG=false APP_TIMEZONE=UTC # Database DATABASE_URL="sqlite:var/storage/app.db" # Security JWT_SECRET="your-64-character-secret-key" JWT_EXPIRY=3600 # Modules ENABLED_MODULES="Blog" # Sessions SESSION_NAME="hdm_boot_session" SESSION_LIFETIME=7200 SESSION_COOKIE_SECURE=true SESSION_COOKIE_HTTPONLY=true # Localization DEFAULT_LOCALE=en_US DEFAULT_TIMEZONE=Europe/Bratislava ENABLE_SLOVAK=true ENABLE_CZECH=true
Module Configuration
Enable/disable modules in .env
:
ENABLED_MODULES="Blog,Ecommerce,Analytics"
๐งช Testing
Framework Tests
# Run all tests composer test # Run specific test suites composer test:unit composer test:integration composer test:functional # Generate coverage report composer test:coverage # Code quality checks composer cs:check composer analyse
Module-specific Tests (Full Module Isolation)
# Blog module tests cd src/Modules/Optional/Blog composer test composer test:coverage # Run via module test runner php run-module-tests.php php run-module-tests.php --coverage
Test Statistics
- Framework Tests: 39 tests, 98 assertions
- Blog Module Tests: 39 tests, 98 assertions
- Total Coverage: 90%+ target
- Code Quality: PHPStan Level 8
๐๏ธ Full Module Isolation
HDM Boot supports Full Module Isolation for enterprise development:
Blog Module Example
src/Modules/Optional/Blog/
โโโ composer.json # Independent package
โโโ vendor/ # Module dependencies (84KB optimized)
โโโ phpunit.xml # Module-specific testing
โโโ run-module-tests.php # Paths-powered test runner
โโโ tests/ # 39 tests, 98 assertions
โโโ README.md # Module documentation
โโโ .github/workflows/ci.yml # Module CI/CD
โโโ src/ # Module source code
Module Development
# Create new isolated module mkdir -p src/Modules/Optional/MyModule cd src/Modules/Optional/MyModule # Initialize module composer init composer require responsive-sk/slim4-paths # Add testing composer require --dev phpunit/phpunit cp ../Blog/phpunit.xml . cp ../Blog/run-module-tests.php . # Run module tests composer test
Benefits
- โ Independent Development - Teams can work on modules separately
- โ Separate CI/CD - Module-specific GitHub Actions
- โ Version Management - Independent module versioning
- โ Marketplace Ready - Modules can be published as packages
- โ
Path Safety - Uses
responsive-sk/slim4-paths
for secure operations
๐ ๏ธ Development Tools
Code Quality
# Route discovery php bin/route-list.php # Environment validation php bin/validate-env.php # Key generation php bin/generate-keys.php # Module isolation check php -r " \$moduleManager = \$container->get('ModuleManager'); \$info = \$moduleManager->getModuleIsolationInfo('Blog'); var_dump(\$info); "
Debugging
# Enable debug mode echo "APP_DEBUG=true" >> .env # View logs tail -f var/logs/app.log # Check module status php bin/route-list.php | grep -i blog
๐ Documentation
- Architecture Guide - Triple Architecture details
- Module Development - Creating and managing modules
- Security Guide - Security best practices
- Deployment Guide - Production deployment
- Full Module Isolation - Enterprise module development
- API Documentation - REST API reference
๐ Production Deployment
Quick Deployment
# 1. Generate secure keys php bin/generate-keys.php # 2. Configure production environment cp .env.example .env # Edit .env with production values # 3. Validate environment php bin/validate-env.php # 4. Deploy composer install --no-dev --optimize-autoloader composer deploy:prod # 5. Verify deployment curl https://yourdomain.com/health
Production Checklist
- โ
Environment:
APP_ENV=prod
,APP_DEBUG=false
- โ Security: Strong JWT_SECRET (64+ characters)
- โ Database: Production database configured
- โ Sessions: Secure session configuration
- โ HTTPS: SSL/TLS enabled
- โ Monitoring: Health endpoints configured
- โ Logging: Production log levels set
๐ Live Demo
Production Instance: https://boot.responsive.sk/
- Homepage: Framework overview and features
- Blog: https://boot.responsive.sk/blog
- API Status: https://boot.responsive.sk/api/status
- Health Check: https://boot.responsive.sk/health
๐ค Contributing
Framework Contributions
- Fork the repository
- Create feature branch:
git checkout -b feature/amazing-feature
- Run tests:
composer test
- Commit changes:
git commit -m 'Add amazing feature'
- Push to branch:
git push origin feature/amazing-feature
- Open Pull Request
Module Contributions
- Create isolated module in
src/Modules/Optional/
- Add module-specific tests and CI
- Document module in README.md
- Submit as separate package or PR
Development Guidelines
- โ PSR-12 code style
- โ PHPStan Level 8 static analysis
- โ 90%+ test coverage requirement
- โ Semantic versioning for releases
- โ Conventional commits for changelog
๐ Project Statistics
- Framework Version: 0.9.0 (Release Candidate)
- PHP Requirement: 8.2+
- Dependencies: 20+ packages
- Test Coverage: 90%+
- Code Quality: PHPStan Level 8
- Modules: 8 Core + 1 Optional (Blog)
- Routes: 29 endpoints
- Documentation: 6 guides
๐ License
MIT License - see LICENSE file for details.
๐ Links
- GitHub Repository: https://github.com/responsive-sk/hdm-boot
- Live Demo: https://boot.responsive.sk/
- Documentation: docs/
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Packagist: responsive-sk/hdm-boot
๐ Acknowledgments
- Slim Framework - Micro framework foundation
- PHP-DI - Dependency injection container
- Monolog - Logging library
- PHPUnit - Testing framework
- responsive.sk - Development team
HDM Boot Framework - Enterprise PHP development with Triple Architecture
Built with โค๏ธ by the HDM Boot Team