# closemarketing/formscrm architecture

> Architecture diagram of the GitHub repository closemarketing/formscrm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/closemarketing/formscrm
- Repository: https://github.com/closemarketing/formscrm

## Overview

##### Main Components

a. WordPress Core Integration Layer:
- Plugin initialization (formscrm.php)
- Admin interface (includes/admin/)
- Assets management (includes/assets/)

b. Forms Integration Layer:
- Supported form plugins:
- GravityForms
- Contact Form 7
- WooCommerce
- WPForms PRO
- Located in includes/formscrm-library/

c. CRM Integration Layer:
- Free CRM connectors:
- Holded
- Clientify
- AcumbaMail
- MailerLite Classic
- Brevo
- Located in includes/crm-library/

d. Helper Components:
- Utility functions (helpers-functions.php)
- CRM library helpers (helpers-library-crm.php)

**[WordPress Site]**

- [FormsCRM Plugin Core]

- [Admin Interface]
- [Configuration & Settings]

- [Forms Integration Layer]
- [GravityForms Connector]
- [Contact Form 7 Connector]
- [WooCommerce Connector]
- [WPForms Connector]

- [CRM Integration Layer]
- [Holded Connector]
- [Clientify Connector]
- [AcumbaMail Connector]
- [MailerLite Connector]
- [Brevo Connector]

- [External Services]
- [CRM Systems]
- [Email Marketing Platforms]

##### Key Interactions to Highlight

a. Form Submission Flow:
- Form submission → Form Connector → CRM Library → External CRM
- Error handling and logging paths

b. Configuration Flow:
- Admin Interface → Settings Storage → CRM Authentication

c. Data Mapping:
- How form fields map to CRM fields
- Feed configuration process

##### Special Features to Note

- Multiple feed support
- Async lead creation in GravityForms
- Dynamic value composition
- Cookie integration for Clientify
- GDPR compliance (direct API connection)

##### Testing Components

A section showing the testing infrastructure:
- Unit tests (tests/unit/)
- Integration tests (tests/brevo.php, tests/clientify.php)

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph WP[WordPress Site]
        Core[WordPress Core]
    end

    subgraph Plugin[FormsCRM Plugin Core]
        Init["Plugin Initialization"]:::core
        Admin["Admin Interface"]:::core
        Assets["Assets Management"]:::core
        
        subgraph Forms["Forms Integration Layer"]
            GF["GravityForms Connector"]:::forms
            CF7["Contact Form 7 Connector"]:::forms
            WC["WooCommerce Connector"]:::forms
            WPF["WPForms Connector"]:::forms
        end
        
        subgraph CRM["CRM Integration Layer"]
            Holded["Holded Connector"]:::crm
            Clientify["Clientify Connector"]:::crm
            AcumbaMail["AcumbaMail Connector"]:::crm
            MailerLite["MailerLite Connector"]:::crm
            Brevo["Brevo Connector"]:::crm
        end
        
        subgraph Helpers["Helper Components"]
            Utils["Utility Functions"]:::helper
            CRMHelpers["CRM Library Helpers"]:::helper
        end
        
        subgraph Testing["Testing Infrastructure"]
            UnitTests["Unit Tests"]:::test
            FormTests["Form Tests"]:::test
            CRMTests["CRM Tests"]:::test
            IntegTests["Integration Tests"]:::test
        end
        
        subgraph Deploy["Deployment Components"]
            BuildTests["Build Tests"]:::deploy
            PHPTests["PHP Tests"]:::deploy
            DeployProc["Deployment Process"]:::deploy
        end
    end

    subgraph External["External Services"]
        CRMSys["CRM Systems"]:::external
        EmailMkt["Email Marketing Platforms"]:::external
    end

    Core --> Init
    Init --> Admin
    Init --> Assets
    
    Admin --> Forms
    Forms --> CRM
    CRM --> External
    
    Forms --> Helpers
    CRM --> Helpers
    
    Testing --> Forms
    Testing --> CRM
    
    Deploy --> Plugin

    %% Click events for component mapping
    click Init "https://github.com/closemarketing/formscrm/blob/trunk/formscrm.php"
    click Admin "https://github.com/closemarketing/formscrm/blob/trunk/includes/admin/class-admin-options.php"
    click Assets "https://github.com/closemarketing/formscrm/blob/trunk/includes/assets/admin.css"
    click GF "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/class-gravityforms.php"
    click CF7 "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/class-contactform7.php"
    click WC "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/class-woocommerce.php"
    click WPF "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/class-wpforms.php"
    click Holded "https://github.com/closemarketing/formscrm/blob/trunk/includes/crm-library/class-crmlib-holded.php"
    click Clientify "https://github.com/closemarketing/formscrm/blob/trunk/includes/crm-library/class-crmlib-clientify.php"
    click AcumbaMail "https://github.com/closemarketing/formscrm/blob/trunk/includes/crm-library/class-crmlib-acumbamail.php"
    click MailerLite "https://github.com/closemarketing/formscrm/blob/trunk/includes/crm-library/class-crmlib-mailerlite.php"
    click Brevo "https://github.com/closemarketing/formscrm/blob/trunk/includes/crm-library/class-crmlib-brevo.php"
    click Utils "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/helpers-functions.php"
    click CRMHelpers "https://github.com/closemarketing/formscrm/blob/trunk/includes/formscrm-library/helpers-library-crm.php"
    click UnitTests "https://github.com/closemarketing/formscrm/tree/trunk/tests/unit/"
    click FormTests "https://github.com/closemarketing/formscrm/blob/trunk/tests/unit/test-forms.php"
    click CRMTests "https://github.com/closemarketing/formscrm/blob/trunk/tests/unit/test-crm.php"
    click IntegTests "https://github.com/closemarketing/formscrm/blob/trunk/tests/brevo.php"
    click BuildTests "https://github.com/closemarketing/formscrm/blob/trunk/.github/workflows/build-tests.yml"
    click PHPTests "https://github.com/closemarketing/formscrm/blob/trunk/.github/workflows/php-test.yml"
    click DeployProc "https://github.com/closemarketing/formscrm/blob/trunk/.github/workflows/deploy.yml"

    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef forms fill:#4CAF50,stroke:#388E3C,color:white
    classDef crm fill:#FF9800,stroke:#F57C00,color:white
    classDef helper fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef test fill:#795548,stroke:#5D4037,color:white
    classDef deploy fill:#607D8B,stroke:#455A64,color:white
    classDef external fill:#9E9E9E,stroke:#616161,color:white
```
