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.
- PhutilEmailAddress — Basic email address 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_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.
- xsprintf() — Parse a sprintf()-style format string in an extensible way.
- xsprintf_callback_example() — Example xsprintf() callback.
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.
- TempFile — Simple wrapper to guarantee temp file will be deleted on object destruction.
Command Execution
- Command Execution — This document describes best practices for executing system commands in PHP using libphutil.
Classes
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
- Future — A 'future' or 'promise' is an object which represents the result of some pending computation.
- BaseHTTPFuture — Execute HTTP requests with a future-oriented API.
- HTTPFuture — Socket-based HTTP future, for making HTTP requests using future semantics.
- HTTPSFuture — Very basic HTTPS future.
- FutureProxy — Wraps another Future and allows you to post-process its result once it resolves.
- ImmediateFuture — Degenerate future which returns an already-existing result without performing any computation.
- FutureIterator — FutureIterator aggregates Futures and allows you to respond to them in the order they resolve.
- HTTPFutureResponseStatus
Functions
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.
- PhutilReadableSerializer — Serialize PHP values and objects into a human-readable format, useful for displaying errors.
Functions
Abstract Abstract Syntax Tree
Other Parsers
Classes
- PhutilDocblockParser — Parse a docblock comment from source code into raw text documentation and metadata (like "@author" and "@return").