izartu API

API Documentation

Table of Contents

Classes

Auth
Session-based authentication: login, logout, session state, route guarding and CSRF tokens. All methods are static; `Auth::start()` must run before any output.
Bookmark
A bookmark: a typed record plus its own persistence (Active Record).
Controller
Route handlers for the front controller (index.php). Each handler deals with one route and returns a `[template, variables]` pair to render, or redirects and exits directly.
Crud
Database access for a table: prepare and run a query, then fetch its rows.
Database
The shared PDO connection, opened on the first query.
Debug
Request diagnostics, collected while DEBUG is on: every executed query with its wall time (fed by DebugStatement), reported as a `Server-Timing` header (browser devtools, curl) and as the query panel at the bottom of the page.
DebugStatement
PDOStatement that reports each execution's wall time to Debug. Installed through `PDO::ATTR_STATEMENT_CLASS` when DEBUG is on (see Database), so every query is timed without touching any call site.
Flash
One-shot session message, shown on the page after a redirect.
Format
Present a timestamp for the view.
Input
Typed access to request input. Superglobals carry no type guarantees (a crafted request can turn any field into an array), so every read narrows to a string here and the rest of the code never touches them raw.
ShowTag
Supply the tag cloud and the tag index to the view, as data for the template to render.
User
User records: look up accounts for authentication.
Version
What is running, and where its source lives.

Traits

Tag
Tag queries: a bookmark's tags and the tag-cloud data.

Enums

Visibility
Whether a bookmark is visible to everyone on the instance or only its owner.

Constants

BASE  : mixed = \env('BASE', \basePath())
Base URL path of the install ('' at a domain root, '/sub' in a sub-directory).
CLOUD_SIZE  : mixed = \max(1, (int) \env('CLOUD_SIZE', '50'))
Most-used tags shown in the tag cloud.
DB_HOST  : mixed = \env('DB_HOST', 'localhost')
Database host ('localhost' by default).
DB_NAME  : mixed = \env('DB_NAME', 'izartu')
Database name ('izartu' by default).
DB_PASS  : mixed = \env('DB_PASS')
Database password (required, no default).
DB_PORT  : mixed = (int) \env('DB_PORT', '3306')
Database port (3306 by default).
DB_USER  : mixed = \env('DB_USER')
Database user (required, no default).
DEBUG  : mixed = \filter_var(\env('DEBUG'), \FILTER_VALIDATE_BOOL)
Debug mode (off by default; `1`/`true`/`on`/`yes` enable it): error output, the Server-Timing header and the query panel.
PAGE_SIZE  : mixed = \max(1, (int) \env('PAGE_SIZE', '10'))
Bookmarks per page on the feed.
PRIVATE_DIR  : mixed = __DIR__ . '/'
Application bootstrap: fixed paths, class autoloading and configuration.
PUBLIC_DIR  : mixed = \dirname(__DIR__) . '/public/'
TAGS_PAGE_SIZE  : mixed = \max(1, (int) \env('TAGS_PAGE_SIZE', '100'))
Tags per page on the tag index (`/tags`).
VERSION  : mixed = \env('VERSION', \Version::running())
The running version, shown in the footer and linked to its source; read from the tree when unset.

Functions

env()  : string
An environment variable as a string, or a default when unset/empty.
basePath()  : string
The base URL path the request came in on: '' at a domain root, '/sub' in a sub-directory install. Off the web there is no request, so the CLI and the test suite get ''.
asset()  : string
A web-root-relative asset path carrying a cache-busting query string.
prompt()  : string

Constants

BASE

Base URL path of the install ('' at a domain root, '/sub' in a sub-directory).

public mixed BASE = \env('BASE', \basePath())

Detected from the request by default; set it when a reverse proxy serves the app under a path the request does not carry.

CLOUD_SIZE

Most-used tags shown in the tag cloud.

public mixed CLOUD_SIZE = \max(1, (int) \env('CLOUD_SIZE', '50'))

DB_HOST

Database host ('localhost' by default).

public mixed DB_HOST = \env('DB_HOST', 'localhost')

DB_NAME

Database name ('izartu' by default).

public mixed DB_NAME = \env('DB_NAME', 'izartu')

DB_PASS

Database password (required, no default).

public mixed DB_PASS = \env('DB_PASS')

DB_PORT

Database port (3306 by default).

public mixed DB_PORT = (int) \env('DB_PORT', '3306')

DB_USER

Database user (required, no default).

public mixed DB_USER = \env('DB_USER')

DEBUG

Debug mode (off by default; `1`/`true`/`on`/`yes` enable it): error output, the Server-Timing header and the query panel.

public mixed DEBUG = \filter_var(\env('DEBUG'), \FILTER_VALIDATE_BOOL)

PAGE_SIZE

Bookmarks per page on the feed.

public mixed PAGE_SIZE = \max(1, (int) \env('PAGE_SIZE', '10'))

PRIVATE_DIR

Application bootstrap: fixed paths, class autoloading and configuration.

public mixed PRIVATE_DIR = __DIR__ . '/'

Every entry point (public/index.php, private/cli/*, the test suite) requires this file; config.php holds the operator-editable settings.

PUBLIC_DIR

public mixed PUBLIC_DIR = \dirname(__DIR__) . '/public/'

TAGS_PAGE_SIZE

Tags per page on the tag index (`/tags`).

public mixed TAGS_PAGE_SIZE = \max(1, (int) \env('TAGS_PAGE_SIZE', '100'))

VERSION

The running version, shown in the footer and linked to its source; read from the tree when unset.

public mixed VERSION = \env('VERSION', \Version::running())

Functions

env()

An environment variable as a string, or a default when unset/empty.

env(string $name[, string $default = '' ]) : string
Parameters
$name : string

The variable name.

$default : string = ''

Value when the variable is unset or empty.

Return values
string

basePath()

The base URL path the request came in on: '' at a domain root, '/sub' in a sub-directory install. Off the web there is no request, so the CLI and the test suite get ''.

basePath() : string
Return values
string

asset()

A web-root-relative asset path carrying a cache-busting query string.

asset(string $path) : string

The file's modification time gives every deployed version its own URL, so a browser never keeps an old copy against new markup. The path stays relative for <base href> (sub-directory installs), and a missing file gets the plain path.

Parameters
$path : string

Path under the web root, for example 'style/main.css'.

Return values
string —

The path, with '?v=' appended when the file is readable.

prompt()

prompt(string $label) : string
Parameters
$label : string
Return values
string
On this page

Search results