How webifycms/app works
Project Type and Purpose
• WebifyCMS is a CMS application framework designed to simplify building web applications, with built-in content management features.
• It is built using PHP and leverages the Yii framework for its infrastructure.
• The project emphasizes Clean Architecture and Domain Driven Design (DDD), and it divides contexts into extensions for modular and reusable functionality.
File Structure
• Top-level files and directories include configuration (config), source code (src), public web files (public), templates, Docker setups (docker), and extension modules (extensions).
• Within src, note the clear separation into layers:
• Application – application bootstrapping.
• Domain – core business logic (staying agnostic of technologies).
• Infrastructure – handling presentation (with separate subdirectories for API, Console, and Web controllers) and service layer bootstrapping.
• The config files are grouped by purpose (e.g., routes, framework parameters, DB, web, and console configurations) making it clear how the environment and request handling are organized.
• Docker configuration is present (with docker/nginx and docker/php) which suggests the deployment and development environment is containerized.
README Insights
• The README outlines the architectural style (Clean Architecture & DDD) and mentions the use of Yii for the underlying framework.
• There is an emphasis on modular extensions (admin, user, site, blog, market for extensions/themes) to facilitate customization.
• The roadmap shows different feature areas being developed, which underpins the need for clear separations between core layers and extension points.
a. Main Components:
• Client/Browser: Interacts with the public/index.php.
• Web Server (Docker/Nginx): Serves the HTTP requests.
• PHP Application (Docker/PHP container): Hosts the application logic.
• Frontend Presentation Layer: The "public" folder, "templates" (layouts, admin, home), and "themes".
• Application Layer: Bootstrapping code in src/Application.
• Domain Layer: Business logic in src/Domain.
• Infrastructure Layer: Manages Presentation and Services; subdivided into API controllers, Web controllers, and Console controllers (in src/Infrastructure/Presentation* directories).
• Configuration and Routing: Files in config folder (framework config, routes for API and Web).
• Extensions: Modular components in the "extensions" folder that extend base functionality.
• External Services/Database: While not shown directly as a directory, the config/framework/db.php file and environment variables in .env indicate database connectivity and possibly other services.
b. Relationships and Interactions:
• Requests initiated from browsers hit the Web Server (Nginx) and are forwarded to the PHP container.
• The public/index.php acts as the entry point, directing incoming web requests to the appropriate controller based on routes defined in config/routes.
• Controllers in the Infrastructure layer (both API and Web) invoke business logic contained in the Domain layer and use Application services.
• Dependency Injection and configuration files (in config/dependencies.php and framework configs) ensure that components interact according to the Clean Architecture principles.
• Extensions plug into the core functionality, allowing customization and addition of features without changing core logic.
• The Docker setup facilitates a separation of environment concerns – meaning that development, testing, and eventual production are all managed in containerized environments.
c. Architectural Patterns and Design Principles:
• Clean Architecture separating concerns into different layers (Presentation, Application, Domain, Infrastructure).
• Domain Driven Design (DDD) ensuring that business rules and logic remain at the center.
• Modular extensions for scalability and customization.
• Usage of dependency injection via configuration for loose coupling.
• Containerization via Docker to isolate infrastructure and deployment concerns.
d. Key Technologies and Frameworks:
• PHP as the programming language.
• Yii Framework for core infrastructure functionalities.
• Docker (compose.yml, Dockerfile) for containerized deployment.
• Potential Database integrations as referenced in config/framework/db.php.
• PHP static analysis and coding standards enforcement tools (referenced via phpstan.dist.neon and php-cs-fixer).