Framework Rule Set

ArtiFrame's power comes from its immutable standards. As long as a developer joining the project follows these rules, system stability is guaranteed.

Rule 01

data-js Architecture

JavaScript events must never be listened to via a class or id. These are visual / stylistic identities. All JS interactions are managed with the data-js attribute. When CSS removes a class, JavaScript never breaks.

Anti-Pattern (Unsupported)
<!-- HTML -->
<button id="submitBtn" class="btn">Gönder</button>

// JavaScript
document.getElementById('submitBtn')
  .addEventListener('click', ...)
ArtiFrame Standard
<!-- HTML -->
<button class="btn btn-primary" data-js="login-submit">Gönder</button>

// JavaScript
document.querySelector('[data-js="login-submit"]')
  .addEventListener('click', ...)
Rule 02

Theme Architecture

Dark/Light mode and themes are managed via the data-theme and data-mode attributes of the <html> tag. body classes are not used.

CSS Variables
<!-- HTML -->
<html lang="tr" data-theme="default" data-mode="light">

/* app.css */
html[data-theme="default"][data-mode="dark"] {
    --bg-color: #0b0c0e;
    --text-main: #ffffff;
}
html[data-theme="default"][data-mode="light"] {
    --bg-color: #ffffff;
    --text-main: #111111;
}
Rule 03

Secure Data Flow

Every data coming from the database is wrapped with ViewMethod display() before being printed to the DOM. Every data coming to the API is cleaned with SystemMethod functions like stripHtml() or sanitizeInt() before being processed.

Rule 04

Error Management with APP_ENV

The APP_ENV value in the .env file determines error visibility (1 = Debug, 0 = Production). In a production environment, PHP stack traces or raw error messages are never shown to the end user.

config/app-version.php
define('APP_ENV', (int)$_ENV['APP_ENV']);

if (APP_ENV === 1) {
    ini_set('display_errors', 1);
    error_reporting(E_ALL);
} else {
    ini_set('display_errors', 0);
}