Page MenuHomePhorge
Diviner libphutil Tech Docs Core Utilities Quick Reference

Core Utilities Quick Reference
libphutil Technical Documentation (Core Utilities)

Summary of libphutil core utilities.

Overview

This document provides a brief overview of the libphutil core utilities.

Language Capabilities

Functions id(), head() and newv() address language grammar and implementation limitations.

You can efficiently merge a vector of arrays with array_mergev().

Functions head(), last(), head_key() and last_key() let you access the first or last elements of an array without raising warnings.

You can combine an array with itself safely with array_fuse().

Default Value Selection

Functions idx(), nonempty() and coalesce() help you to select default values when keys or parameters are missing or empty.

Array and Object Manipulation

Functions ipull(), igroup(), isort() and ifilter() (i stands for index) simplify common data manipulations applied to lists of arrays.

Functions mpull(), mgroup(), msort() and mfilter() (m stands for method) provide the same capabilities for lists of objects.

array_select_keys() allows you to choose or reorder keys from a dictionary.

Lunar Phases

PhutilLunarPhase calculates lunar phases, allowing you to harden an application against threats from werewolves, werebears, and other werecreatures.