Diviner

Overview

Core Utilities

Classes

  • AbstractDirectedGraph — Models a directed graph in a generic way that works well with graphs stored in a database, and allows you to perform operations like cycle detection.
  • PhutilArray — Abstract base class for implementing objects that behave like arrays.
  • PhutilBufferedIterator — Simple iterator that loads results page-by-page and handles buffering.
  • PhutilEmailAddress — Basic email address parser.
  • PhutilGitURI — Parser for the alternate URI scheme used by SCP and Git, which look like this: user@host:path (Git calls these URIs "scp-style" in its documentation, but most users and developers are likely to run into them in the context of Git and I couldn't find an official name or specification, so I'm going with "GitURI".) Note that these URIs can not be transformed into normal URIs because the path is interpreted as relative on the remote, rather than absolute (as with normal URIs).
  • PhutilGitURITestCase — Test cases for PhutilGitURI parser.
  • PhutilJSON — Utilities for wrangling JSON.
  • PhutilLanguageGuesser — Very simple class to guess the languages of source files which we failed to determine by examining file name/extension rules.
  • PhutilServiceProfiler — Simple event store for service calls, so they can be printed to stdout or displayed in a debug console.
  • PhutilSimpleOptions — Utilities for parsing simple option lists used in Remarkup, like codeblocks: lang=text lang=php, name=example.php, lines=30, counterexample
  • PhutilURI — Basic URI parser object.

Functions

  • array_fuse() — Simplifies a common use of array_combine().
  • array_interleave() — Add an element between every two elements of some array.
  • array_mergev() — Merge a vector of arrays performantly.
  • array_select_keys() — Selects a list of keys from an array, returning a new array with only the key-value pairs identified by the selected keys, in the specified order.
  • assert_instances_of() — Checks if all values of array are instances of the passed class.
  • coalesce() — Returns the first argument which is not strictly null, or null if there are no such arguments.
  • head() — Returns the first element of an array.
  • head_key() — Returns the first key of an array.
  • id() — Identity function, returns its argument unmodified.
  • idx() — Access an array index, retrieving the value stored there if it exists or a default if it does not.
  • ifilter() — Filter a list of arrays by removing the ones with an empty() value for some index.
  • igroup() — Group a list of arrays by the value of some index.
  • ipull() — Choose an index from a list of arrays.
  • isort() — Sort a list of arrays by the value of some index.
  • last() — Returns the last element of an array.
  • last_key() — Returns the last key of an array.
  • mfilter() — Filter a list of objects by executing a method across all the objects and filter out the ones wth empty() results.
  • mgroup() — Group a list of objects by the result of some method, similar to how GROUP BY works in an SQL query.
  • mpull() — Call a method on a list of objects.
  • msort() — Sort a list of objects by the return value of some method.
  • newv() — Invokes the "new" operator with a vector of arguments.
  • nonempty() — Similar to coalesce(), but less strict: returns the first non-empty() argument, instead of the first argument that is strictly non-null.
  • phutil_split_lines() — Split a corpus of text into lines.
  • ppull() — Access a property on a list of objects.
  • xsprintf() — Parse a sprintf()-style format string in an extensible way.
  • xsprintf_callback_example() — Example xsprintf() callback.

Phutil Library System

UTF-8

Functions

Internationalization

Classes

Functions

  • pht() — Translate a string.

Interfaces

Filesystem

Classes

  • FileFinder — Find files on disk matching criteria, like the 'find' system utility.
  • FileList — A list of files, primarily useful for parsing command line arguments.
  • Filesystem — Simple wrapper class for common filesystem tasks like reading and writing files.
  • FilesystemException — Exception thrown by Filesystem to indicate an error accessing the file system.
  • LinesOfALarge — Abstraction for processing large inputs without holding them in memory.
  • PhutilDeferredLog — Object that writes to a logfile when it is destroyed.
  • PhutilDirectoryFixture
  • PhutilLock — Base class for locks, like file locks.
    • PhutilFileLock — Wrapper around flock() for advisory filesystem locking.
  • TempFile — Simple wrapper to create a temporary file and guarantee it will be deleted on object destruction.

Command Execution

  • Command Execution — This document describes best practices for executing system commands in PHP using libphutil.

Classes

  • CommandException — Exception thrown when a system command fails.
  • ExecFuture — Execute system commands in parallel using futures.

Functions

  • csprintf() — Format a shell command string.
  • exec_manual() — Execute a command and capture stdout, stderr, and the return value.
  • execx() — Execute a command and capture stdout and stderr.
  • phutil_passthru() — Execute a command which takes over stdin, stdout and stderr, similar to passthru(), but which preserves TTY semantics, escapes arguments, and is traceable.
  • vcsprintf() — Version of csprintf() that takes a vector of arguments.
  • xsprintf_command() — xsprintf() callback for csprintf().

Futures

Classes

Functions

Channels (I/O Wrappers)

Classes

Error Handling

Classes

  • PhutilAggregateException — Exception that aggregates other exceptions into a single exception.
  • PhutilErrorHandler — Improve PHP error logs and optionally route errors, exceptions and debugging information to a central listener.
  • PhutilProxyException — Prior to PHP 5.3, PHP does not support nested exceptions; this class provides limited support for nested exceptions.
  • PhutilReadableSerializer — Serialize PHP values and objects into a human-readable format, useful for displaying errors.

Functions

Markup

Classes

Functions

Console Utilities

Classes

Functions

Abstract Abstract Syntax Tree

Classes

Conduit (Service API)

Daemons

Classes

Other Parsers

Classes

  • PhutilDocblockParser — Parse a docblock comment from source code into raw text documentation and metadata (like "@author" and "@return").

Test Cases

Classes

lexer

Classes

mercurial

Functions

aphront

Classes

cache

Classes

paypal

Free Radicals

Classes

Functions

Interfaces