How rapidez/statamic works
Main Components
• Configuration & Setup: Represent the configuration files (found under the “config/rapidez” directory) that initialize Statamic-specific settings (including builder configuration).
• Resources & Templating: Include the various resources such as blueprints, fieldsets, JS assets (including Vue components), and Blade templates in the “resources” folder. This component deals with the frontend presentation and content structure.
• Core Business Logic: The “src” directory is the core of the package. It includes:
• Actions (business logic like sitemap generation and brand imports),
• Collections (managing data collections such as Brands, Categories, and Products),
• Commands (CLI commands for installation, importing, and cache invalidation),
• Controllers and HTTP logic (handling requests for imports and view composition),
• Jobs and Listeners (handling asynchronous tasks and event-driven actions),
• Models and Observers (providing data representation for brands, products, etc.).
• Extension & Integration Layers: This includes Facades, Service Providers (like RapidezStatamicServiceProvider.php) and custom Tags that expose the package’s extended functionality to both Rapidez and Statamic.
• Development Infrastructure: Don’t forget the developer-oriented components such as GitHub workflows, changelog automation, and composer.json for dependency management.
Component Interactions and Relationships
• A web request handled by a controller may trigger an Action (e.g., generating a sitemap) that is processed by a queued Job.
• A user action in the frontend (using JS components) might lead to an API call that is routed through HTTP controllers.
• Integration Points: Highlight how the Configuration layer feeds into the Core Business Logic (for example, pulling settings from “config/rapidez/statamic”) and how the Service Provider and Facade allow the package to hook into Rapidez and Statamic’s ecosystems.
• Asynchronous / Event-Driven Elements: Illustrate event listeners (e.g., ClearNavTreeCache, SetCollectionsForNav) reacting to changes (possibly from Commands or from Model Observers).
Architectural Patterns
• Separation of Concerns: The project clearly separates configuration, resource management (views, blueprints), and business logic.
• Modular Design: The “src” directory demonstrates a modular approach by splitting functionality into distinct folders (Actions, Commands, Collections) which is ideal for extendable integration.
• MVC-Inspired Structure: Even if not a full MVC application, there’s a mix of Controllers, Models, and Views (Blade templates) that follows MVC principles, particularly in the integration with Statamic.
Specific Technologies, Frameworks, or Libraries
• PHP with Composer for dependency management.
• Statamic as the integrated CMS.
• Vue.js in the “resources/js” folder for UI components.
• Blade templating engine indicated by the .blade.php files.
• GitHub Actions for CI/CD processes based on the workflows files.