Chaos MVC developer reference

Codex

The authoritative reference for the supported public Chaos MVC API.

Only declarations explicitly marked @api are included. Public PHP visibility alone does not establish a supported API.

content_renderer

render

method
public static function render(string $text): string

Render content $text.

Parameters

Name Type Required Default Description
$text string Yes —

Returns

string

Declared in /app/lib/content_renderer.php, line 16

controller

csrf_token

method
public function csrf_token(): string

Return a CSRF token.

Returns

string

Declared in /app/core/controller.php, line 138

isUserModule

method
public function isUserModule(): bool

Return whether this controller is executing from user-land.

Returns

bool

Declared in /app/core/controller.php, line 118

view

method
public function view($view, $data = []): void

Render a view.

Parameters

Name Type Required Default Description
$view string|array Yes — View identifier.
$data array No [] View data.

Returns

void

Declared in /app/core/controller.php, line 247

error_handler

bad_request

method
public function bad_request(): never

Returns

never

Declared in /app/core/error_handler.php, line 190

illegal_entity

method
public function illegal_entity(): never

Returns

never

Declared in /app/core/error_handler.php, line 206

not_found

method
public function not_found(): never

Returns

never

Declared in /app/core/error_handler.php, line 214

server_error

method
public function server_error(): never

Returns

never

Declared in /app/core/error_handler.php, line 222

service_unavailable

method
public function service_unavailable(): never

Returns

never

Declared in /app/core/error_handler.php, line 230

unauthorized

method
public function unauthorized(): never

Returns

never

Declared in /app/core/error_handler.php, line 198

global

error_page

function
public function error_page($message): never

Render the Core error page.

Parameters

Name Type Required Default Description
$message string Yes — Error message.

Returns

never

Declared in /app/core/controller.php, line 560

model

function
public function model($model)

Load a model.

Parameters

Name Type Required Default Description
$model string Yes — Model class name.

Returns

object

Declared in /app/core/controller.php, line 339

module_model

function
public function module_model(string $module, string $model): object

Load a model explicitly owned by another user module.

Parameters

Name Type Required Default Description
$module string Yes —
$model string Yes —

Returns

object

Declared in /app/core/controller.php, line 511

mailer

create

method
public function create(): \PHPMailer\PHPMailer\PHPMailer

Returns

\PHPMailer\PHPMailer\PHPMailer

Declared in /app/lib/mailer.php, line 31

model

archive

method
public function archive($table, $where, $params = [])

Parameters

Name Type Required Default Description
$table Yes —
$where Yes —
$params No []

Declared in /app/core/model.php, line 81

exists

method
public function exists($table, $where, $params = [])

Parameters

Name Type Required Default Description
$table Yes —
$where Yes —
$params No []

Declared in /app/core/model.php, line 108

fetch

method
public function fetch(string $sql, array $params = [])

Parameters

Name Type Required Default Description
$sql string Yes —
$params array No []

Declared in /app/core/model.php, line 121

fetchAll

method
public function fetchAll(string $sql, array $params = [])

Parameters

Name Type Required Default Description
$sql string Yes —
$params array No []

Declared in /app/core/model.php, line 133

insert

method
public function insert($table, $data)

Parameters

Name Type Required Default Description
$table Yes —
$data Yes —

Declared in /app/core/model.php, line 41

query

method
public function query($sql, $params = [])

Parameters

Name Type Required Default Description
$sql Yes —
$params No []

Declared in /app/core/model.php, line 29

restore

method
public function restore($table, $where, $params = [])

Parameters

Name Type Required Default Description
$table Yes —
$where Yes —
$params No []

Declared in /app/core/model.php, line 95

update

method
public function update($table, $data, $where, $whereParams = [])

Parameters

Name Type Required Default Description
$table Yes —
$data Yes —
$where Yes —
$whereParams No []

Declared in /app/core/model.php, line 59

render_md

markdown

method
public function markdown(string $text): string

Render Markdown $text

Parameters

Name Type Required Default Description
$text string Yes —

Returns

string

Declared in /app/lib/render_md.php, line 32

markdown_file

method
public function markdown_file(string $path): void

Render Markdown $file

Parameters

Name Type Required Default Description
$path string Yes —

Returns

void

Declared in /app/lib/render_md.php, line 17

theme

activeSlug

method
public static function activeSlug(): string

Returns

string

Declared in /app/core/theme.php, line 11

assetUrl

method
public static function assetUrl(string $path): string

Parameters

Name Type Required Default Description
$path string Yes —

Returns

string

Declared in /app/core/theme.php, line 94

render

method
public static function render(string $part, array $scope = []): bool

Parameters

Name Type Required Default Description
$part string Yes —
$scope array No []

Returns

bool

Declared in /app/core/theme.php, line 74

trash_filter

clean

method
public function clean(string $text, bool $drop = false): string

Parameters

Name Type Required Default Description
$text string Yes —
$drop bool No false

Returns

string

Declared in /app/lib/trash_filter.php, line 8

utility

nav_active

method
public function nav_active(string $href, string $current): string

Parameters

Name Type Required Default Description
$href string Yes —
$current string Yes —

Returns

string

Declared in /app/core/utility.php, line 9

redirect_to

method
public function redirect_to(string $url): never

Parameters

Name Type Required Default Description
$url string Yes —

Returns

never

Declared in /app/core/utility.php, line 33