Libraries

Add what your program needs.

60 libraries for the web, data formats, data structures, security, CLI tools, threads and desktop apps. 59 official libraries ship bundled with the compiler; 1 more are available from the community registry with hphp install <name>.

All libraries (60)

httpRouter, requests and responses, and a small HTTP server. Web & networking · v1.0.0 · bundled asyncOne event loop for timers, sockets, TCP servers and HTTP. Web & networking · v1.0.0 · bundled testingAssertions for hphp test with readable failure messages. Tooling & CLI · v1.0.0 · bundled cliArguments, questions, tables, progress bars and colors. Tooling & CLI · v1.0.0 · bundled threadOS threads, channels, mutexes and a worker pool. Concurrency · v1.0.0 · bundled dotenvConfiguration from .env files and the environment. Tooling & CLI · v1.0.0 · bundled websocketWebSocket servers: handshake, frames, chat-style broadcasting. Web & networking · v1.0.0 · bundled uiNative windows, widgets, menus, dialogs and themes. Desktop · v2.0.0 · bundled htmlParse HTML and CSS, lay out and paint documents. Desktop · v1.0.0 · bundled ansiTerminal ANSI colors, 256-color & RGB styling, stripping and progress bars. Tooling & CLI · v1.0.0 · bundled base32RFC 4648 Base32, Crockford Base32 and Base58 encoders and decoders. Security & encoding · v1.0.0 · bundled bitsetCompact bitflags and bit-array manipulation with popcount and bitwise ops. Data structures · v1.0.0 · bundled bloomSpace-efficient probabilistic Bloom filter with capacity-based sizing. Data structures · v1.0.0 · bundled checksumCRC-32, Adler-32, FNV-1a, DJB2 and Luhn checksums and non-crypto hashes. Security & encoding · v1.0.0 · bundled cipherROT13, Caesar, Vigenere, repeating-key XOR, Atbash and constant-time compare. Security & encoding · v1.0.0 · bundled cliargsCLI argument and flag parser with auto-generated help and validation. Tooling & CLI · v1.0.0 · bundled collectionsFluent collection and array pipeline utilities for HolyPHP. Data structures · v1.0.0 · bundled colorColor parsing, RGB/HSL/Hex conversion, manipulation and WCAG contrast. Math, time & IDs · v1.0.0 · bundled cron5-field cron expression parser, matcher, human describer and next-match finder. Math, time & IDs · v1.0.0 · bundled csvRFC 4180 CSV parser and writer with headers, custom delimiters and escaping. Data formats · v1.0.0 · bundled datetimeHDateTime class with ISO-8601 parsing, formatting, arithmetic and relative time. Math, time & IDs · v1.0.0 · bundled diDependency injection and service container with singletons and cycle detection. Application & logic · v1.0.0 · bundled diffLine-by-line LCS text diffing with unified diff output and change stats. Text & strings · v1.0.0 · bundled envfile.env parser, validator and config container with interpolation and typed getters. Data formats · v1.0.0 · bundled eventEventEmitter / pub-sub event bus with once and wildcard listeners. Application & logic · v1.0.0 · bundled formatHuman-readable formatters for byte sizes, durations, numbers, percentages and currency. Text & strings · v1.0.0 · bundled fsmFinite State Machine builder with transitions, history and enter/exit hooks. Application & logic · v1.0.0 · bundled fuzzyFuzzy string matching, Levenshtein distance, similarity scoring and ranked search. Text & strings · v1.0.0 · bundled globGlob pattern matcher supporting *, ?, **, character classes and brace alternation. Text & strings · v1.0.0 · bundled graphDirected/undirected weighted graph with BFS, DFS, Dijkstra, toposort and cycles. Data structures · v1.0.0 · bundled heapBinary MinHeap, MaxHeap and PriorityQueue data structures. Data structures · v1.0.0 · bundled iniINI configuration parser and writer with sections, comments and typed getters. Data formats · v1.0.0 · bundled jwtJSON Web Token HS256 encoder, decoder and verifier with pure-HolyPHP SHA-256. Security & encoding · v1.0.0 · bundled lexerRule-based tokenizer and lexer builder with line/column tracking and syntax errors. Tooling & CLI · v1.0.0 · bundled loggerStructured leveled logger with text/JSON formatters, context fields and sinks. Tooling & CLI · v1.0.0 · bundled lruFixed-capacity LRU cache with hit/miss statistics and optional TTL expiration. Data structures · v1.0.0 · bundled markdownMarkdown-to-HTML converter supporting headings, code blocks, lists, links and escaping. Data formats · v1.0.0 · bundled passwordPassword strength analyzer, configurable generator and passphrase generator. Security & encoding · v1.0.0 · bundled pluralEnglish pluralize/singularize engine with irregulars, count formatting and ordinals. Text & strings · v1.0.0 · bundled ratelimitToken bucket and sliding-window rate limiters with per-key tracking. Web & networking · v1.0.0 · bundled retryRetry and circuit breaker utilities with exponential backoff and state management. Application & logic · v1.0.0 · bundled ringbufferFixed-size circular buffer (RingBuffer) for streaming data and sliding windows. Data structures · v1.0.0 · bundled routerHTTP/path URL router with named params, wildcards, route groups and 404/405. Web & networking · v1.0.0 · bundled sanitizeInput sanitization for HTML, filenames, paths, SQL identifiers and whitespace. Application & logic · v1.0.0 · bundled semverSemantic Versioning (SemVer 2.0.0) parser, comparator, bumper and range matcher. Application & logic · v1.0.0 · bundled setMathematical Set with union, intersection, difference, subset and equality ops. Data structures · v1.0.0 · bundled statsDescriptive statistics and math library (mean, median, stddev, percentiles). Math, time & IDs · v1.0.0 · bundled strString helpers for casing, slugging, padding, wrapping, truncation and inspection. Text & strings · v1.0.0 · bundled tableASCII & Unicode terminal table renderer with alignment and border styles. Tooling & CLI · v1.0.0 · bundled templateMustache-style template engine with HTML escaping, raw output, conditionals and loops. Text & strings · v1.0.0 · bundled testLightweight unit testing and assertion framework with diff-style failure messages. Tooling & CLI · v1.0.0 · bundled tomlTOML parser and serializer with tables, dotted keys, arrays and line-numbered errors. Data formats · v1.0.0 · bundled totpRFC 4226 HOTP & RFC 6238 TOTP 2FA generator with Base32 and otpauth URIs. Security & encoding · v1.0.0 · bundled triePrefix tree (Trie) for word insertion, lookup, deletion, prefixes and autocomplete. Data structures · v1.0.0 · bundled urlURL parser, builder, query string encoder/decoder, percent-encoding and path joiner. Web & networking · v1.0.0 · bundled uuidUUID v4, UUID v7, NIL UUID and ULID generator, validator and formatter. Math, time & IDs · v1.0.0 · bundled validateDeclarative schema and input validator with structured per-field error messages. Application & logic · v1.0.0 · bundled xmlLightweight XML parser, DOM builder, serializer and query helper with entity escaping. Data formats · v1.0.0 · bundled yamlYAML subset parser and emitter with nested mappings, sequences and syntax errors. Data formats · v1.0.0 · bundled mathxSmall integer math helpers (clampi, sqi). Math, time & IDs · v1.0.0 · community

Bundled vs. community registry

Bundled libraries ship inside the compiler binary so import "<name>"; works offline. Community registry packages are hosted at http://hphp.ch:8930 — add them to a project with hphp install <name> or globally with hphp pkg install <name>.

Built into the language

Some features need no library at all: strings, arrays, math, JSON, regular expressions, files, dates, hashing and SQLite are built-in functions. See the documentation.

Publish your own

Start with hphp create mylib -t lib, test it with hphp test, then hphp pkg publish. See Projects & packages.