Skip to content

Beautiful Open-Source Form Builder

5.4 KB
Raw Blame
<?php

/**
 * OpnForm Plans Configuration
 *
 * SINGLE SOURCE OF TRUTH for all pricing, features, and limits.
 * Do not hardcode tier logic elsewhere in the codebase.
 */

return [
    /**
     * Tier definitions and ordering
     */
    'tiers' => [
        'free' => ['order' => 0, 'name' => 'Free', 'price_monthly' => 0, 'price_yearly' => 0, 'price_yearly_per_month' => 0],
        'pro' => ['order' => 1, 'name' => 'Pro', 'price_monthly' => 29, 'price_yearly' => 299, 'price_yearly_per_month' => 25],
        'business' => ['order' => 2, 'name' => 'Business', 'price_monthly' => 79, 'price_yearly' => 799, 'price_yearly_per_month' => 67],
        'enterprise' => ['order' => 3, 'name' => 'Enterprise', 'price_monthly' => 250, 'price_yearly' => 2640, 'price_yearly_per_month' => 220],
        'self_hosted' => ['order' => 4, 'name' => 'Self-hosted Enterprise', 'price_monthly' => 199, 'price_yearly' => 1999, 'price_yearly_per_month' => 167],
    ],

    /**
     * Map subscription names to tiers (for Stripe subscriptions)
     */
    'subscription_tier_mapping' => [
        'default' => 'pro',      // Legacy subscriptions
        'pro' => 'pro',
        'business' => 'business',
        'enterprise' => 'enterprise',
        'self_hosted' => 'self_hosted'
    ],

    /**
     * Feature to minimum tier mapping
     * If a feature is not listed, it's available to all tiers (free)
     */
    'features' => [
        // Pro
        'branding.removal' => 'pro',
        'workspaces.multiple' => 'pro',
        'invite_user' => 'pro',
        'custom_domain' => 'pro',
        'form_summary' => 'pro',
        'form_analytics' => 'pro',
        'ai.form_generation' => 'pro',
        'custom_smtp' => 'pro',
        'security.password_protection' => 'pro',
        'security.form_expiration' => 'pro',
        'security.captcha' => 'pro',
        'integrations.slack' => 'pro',
        'integrations.discord' => 'pro',
        'integrations.telegram' => 'pro',
        'integrations.email.advanced' => 'pro',
        'file_upload.allowed_types' => 'pro',
        'editable_submissions' => 'pro',
        'id_generation' => 'pro',


        // Business
        'branding.advanced' => 'business',  // CSS, fonts
        'custom_code' => 'business',
        'custom_domain.wildcard' => 'business',
        'multi_user.roles' => 'business',
        'integrations.hubspot' => 'business',
        'integrations.salesforce' => 'business',
        'integrations.airtable' => 'business',
        'partial_submissions' => 'business',
        'enable_partial_submissions' => 'business',
        'form_versioning' => 'business',
        'google_address_autocomplete' => 'business',
        'database_fields_update' => 'business',
        'enable_ip_tracking' => 'business',


        // Enterprise
        'sso.oidc' => 'enterprise',
        'sso.saml' => 'enterprise',
        'sso.ldap' => 'enterprise',
        'audit_logs' => 'enterprise',
        'compliance_features' => 'enterprise',
        'external_storage' => 'enterprise',
        'white_label' => 'enterprise',
    ],

    /**
     * Numeric limits per tier (null = unlimited)
     */
    'limits' => [
        'file_upload_size' => [
            'free' => 10 * 1024 * 1024,        // 10 MB
            'pro' => 50 * 1024 * 1024,         // 50 MB
            'business' => 1024 * 1024 * 1024,  // 1 GB
            'enterprise' => null,               // Unlimited/configurable
        ],
        'custom_domain_count' => [
            'free' => 0,
            'pro' => 1,
            'business' => 10,
            'enterprise' => null,  // Unlimited
        ],
        'workspace_count' => [
            'free' => 1,
            'pro' => null,      // Unlimited
            'business' => null,
            'enterprise' => null,
        ],
    ],

    /**
     * Form feature to tier mapping (used by FormCleaner)
     */
    'form_features' => [
        // Pro tier features
        'no_branding' => 'pro',
        'redirect_url' => 'pro',
        'secret_input' => 'pro',
        'analytics' => 'pro',
        'seo_meta' => 'pro',

        // Business tier features
        'custom_css' => 'business',
        'enable_partial_submissions' => 'business',
        'editable_submissions' => 'pro',
        'database_fields_update' => 'business',
        'enable_ip_tracking' => 'business',

        // Enterprise tier features
    ],

    /**
     * Default values for form features when cleaned (tier requirement not met)
     */
    'form_feature_defaults' => [
        'no_branding' => false,
        'redirect_url' => null,
        'custom_css' => null,
        'seo_meta' => [],
        'analytics' => [],
        'enable_partial_submissions' => false,
        'editable_submissions' => false,
        'database_fields_update' => null,
        'enable_ip_tracking' => false,
        'secret_input' => false,
    ],

    /**
     * Self-hosted license configuration.
     * Maps License API feature keys to application feature keys from the 'features' section above.
     */
    'self_hosted_features' => [
        'sso' => ['sso.saml', 'sso.ldap'],
        'multiOrg' => ['workspaces.multiple', 'multi_user.roles'],
        'whitelabel' => ['branding.removal', 'branding.advanced', 'white_label'],
        'custom_smtp' => ['custom_smtp'],
        'audit_logs' => ['audit_logs', 'compliance_features'],
        'external_storage' => ['external_storage'],
        'custom_code' => ['custom_code', 'custom_css'],
    ],
];