izartu API

Documentation

Table of Contents

Packages

Application

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.
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.
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
Render the tag cloud.
User
User records: look up accounts for authentication.

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.
TAGS_PAGE_SIZE  : mixed = \max(1, (int) \env('TAGS_PAGE_SIZE', '100'))
Tags per page on the tag index (`/tags`).

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 ''.
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.

TAGS_PAGE_SIZE

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

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

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

prompt()

prompt(string $label) : string
Parameters
$label : string
Return values
string

Search results