This directory is the developer reference for initphp/escaper. The
top-level README is intentionally short; everything in
depth lives here.
- Getting started — install, first call, the
Escfacade vs. instantiatingEscaper. - Per-context guides — one file per output context, with the rules
the escaper applies, the threats it defeats, and runnable examples:
- HTML body context (
escHtml) - HTML attribute context (
escHtmlAttr) - JavaScript context (
escJs) - CSS context (
escCss) - URL context (
escUrl)
- HTML body context (
- Encodings — non-UTF-8 input/output, the supported list and how conversion is performed.
- Exceptions — the exception tree and when each one is thrown.
- Security notes — caveats, common misuses, and pointers to authoritative sources.
- Code samples assume the autoloader has already been required.
- Output shown in
// commentsis the literal string the escaper returns. Each sample was generated by running the escaper itself, not hand-written. - "Untrusted" means any data that has touched the network, the filesystem, a database, or anything else outside your PHP process — in other words, "almost everything".