# DOCS v2.0.0 FULL API - Matches Code

## Bootstrap v2 (system/php/core/bootstrap.core.php)
- systemRoot = /home/.../tmp/v1
- systemPath = systemRoot/system
- logsPath = systemRoot/system/logs
- envPath = systemRoot/.env
- loadEnv(envPath) reads .env, trim($v, "'\"\"") fixed
- envGet('DB_CHARSET','utf8mb4') from .env
- $systemConfig['database']['charset'] = envGet('DB_CHARSET')
- sysLoadJson('apps.registry.json') loads apps
- sysBaseUrl() returns BASE_URL from .env
- define baseUrl, systemUrl, assetsUrl
- sysConfig('database.charset') = utf8mb4
- sysPath('core') = system/php/core
- appRegistry() returns all 12 apps
- appPath('games.hangman') = systemRoot/websites/apps/games/hangman
- appUrl('games.hangman') = baseUrl + path
- appConfig('games.hangman') = json_decode app.config.json

## Auth Free (system/php/core/auth.core.php)
- authRegister($username,$email,$password): checks len>=6, email valid, password_hash, INSERT users, throws Duplicate
- authLogin($username,$password): SELECT WHERE username=? OR email=?, password_verify, $_SESSION[user_id], UPDATE last_login
- authLogout(): session_destroy
- authUser(): SELECT id,username,email FROM users WHERE id=?
- isLoggedIn(): !empty($_SESSION[user_id])
- dbInit(): CREATE TABLE IF NOT EXISTS users and game_scores utf8mb4

## Database (system/php/core/database.core.php)
- dbConnect(): $c=sysConfig('database'), DSN mysql:host=...;dbname=...;charset=utf8mb4, PDO, SET NAMES utf8mb4
- Uses .env DB_HOST, DB_NAME, DB_USER, DB_PASS, DB_CHARSET

## Audit v2 (audit.php)
- $tests array, addTest() never exits
- Tests: .env exists, baseUrl defined, systemRoot valid, DB_CHARSET from .env, DB config from .env, DB connection, appConfig() works, appPath() works, appUrl() works, no duplicate functions, apps registry count >=12, scanSystem()
- scanSystem() in lib checks .env, baseUrl, charset, duplicate funcs, app paths, DB connection - returns issues array
- auditReport() score
- Renders table, then Errors Summary at End, Warnings at End, never exits early

## Games v2
Each game: app.config.json {id,title,icon,description,version v2.0.0}
index.php: require bootstrap, include header, $cfg=appConfig($appId), playable JS, footer
Uses: esc(), versionShow()=v2.0.0, sysConfig('database.charset')

## Tools v2
- tools/auth: free registration/login, no payment, uses auth.core.php
- tools/dashboard: shows system info
- tools/notes, filemanager: placeholders with auth

## Tools sh
- lint.all.sh: for f in $(find . -name "*.php"); do php -l "$f"; done
- backup.sh: tar czf backup-v2-$(date).tar.gz
- deploy.sh: unzip -o v2-full-all.zip
- audit.sh: curl -s baseUrl/audit.php

## Version Marking v2
- versionCurrent()=v2.0.0, versionShow()=v2.0.0, APP_VERSION=v2.0.0 in .env, footer v2 Full Free Auth + 8 Games
