Architecture

Core framework

The core framework defines how Paradigm CMS loads configuration, templates, extensions, blocks, and requests.

Entry point chain

The CMS boot sequence follows a fixed chain of files:

src/index.php
  → src/paradigm-cms/index.php
    → includes/12.0.0/index.php

The entrypoint loads config.php, validates the configured version, and then bootstraps the runtime from the versioned includes/ directory.

Global variables and constants

These globals are available throughout extensions, blocks, layouts, and request handlers:

Name Type Description
$siteConfig Variable (array) Full site configuration array
$PAPI_CONFIG Variable (array) Parsed extension configuration
$paradigm_db Variable (object) Database connection (ParadigmDB instance)
CURRENT_USER Constant (array) Authenticated user data (id, email, fname, lname, is_admin, users)
SITEURL Constant (string) Base site URL
ROOT_DIR Constant (string) Filesystem root path
APIURL Constant (string) API base URL

Note: CURRENT_USER is a constant, not a variable. Access it with CURRENT_USER['id'], not $CURRENT_USER.

Template system

ACTIVE_TEMPLATE selects which template folder under templates/ is loaded. The runtime expects each template to provide a config.php with header, layout, and footer definitions.

Template configuration declares supported headers, layouts, footers, and menu positions so the CMS can map pages to a consistent presentation layer.

Layouts

Page layouts are referenced by slug and typically follow the pattern template:<layout> or extension:<layout>. Core activation seeds pages that demonstrate this pattern (for example, template:home and users:dashboard).

Extension selection and versioning

Extensions are discovered in extensions/<slug>/<version>/. If a version is not explicitly set in configuration, the runtime selects the latest semantic version available in the extension folder.

Object schema and data layer

Extension data models are declared in src/config/objects/ JSON files. The core schema updater reads these definitions to create tables and meta tables using a consistent naming convention. See Database schema for the full format.

Query syntax (PAPI_get_object conditions)

Conditions use nested arrays. Each inner group is OR'd, outer groups are AND'd:

// (status = 'active' OR status = 'draft') AND (org_ID = 5)
PAPI_get_object('ext:object', array(
    array(
        array('status', '=', 'active'),
        array('status', '=', 'draft')   // OR
    ),
    array(
        array('organization_ID', '=', 5) // AND
    )
), 'internal');

See PHP conventions for all database helper functions.

Docs system

The core extension includes a documentation system used to retrieve extension topics and articles, keeping developer guides near the code that they describe.