Same name and namespace in other branches
  1. 8.9.x core/core.api.php \utility
  2. 9 core/core.api.php \utility

Overview of utility classes and functions for developers.

Drupal provides developers with a variety of utility functions that make it easier and more efficient to perform tasks that are either really common, tedious, or difficult. Utility functions help to reduce code duplication and should be used in place of one-off code whenever possible.

See also

common.inc

File interface

Formatting

PHP wrapper functions

sanitization

Transliteration

validation

File

core/core.api.php, line 1573
Documentation landing page and topics, plus core library hooks.

Classes

Namesort ascending Location Description
Xss core/lib/Drupal/Component/Utility/Xss.php Provides helper to filter for cross-site scripting.
Variable core/lib/Drupal/Component/Utility/Variable.php Provides helpers for dealing with variables.
UserAgent core/lib/Drupal/Component/Utility/UserAgent.php Provides user agent related utility functions.
Unicode core/lib/Drupal/Component/Utility/Unicode.php Provides Unicode-related conversions and operations.
Timer core/lib/Drupal/Component/Utility/Timer.php Provides helpers to use timers throughout a request.
Tags core/lib/Drupal/Component/Utility/Tags.php Defines a class that can explode and implode tags.
SortArray core/lib/Drupal/Component/Utility/SortArray.php Provides generic array sorting helper methods.
Settings core/lib/Drupal/Core/Site/Settings.php Read only settings that are initialized with the class.
OpCodeCache core/lib/Drupal/Component/Utility/OpCodeCache.php Provides helpers to handle PHP opcode caches.
Number core/lib/Drupal/Component/Utility/Number.php Provides helper methods for manipulating numbers.
NestedArray core/lib/Drupal/Component/Utility/NestedArray.php Provides helpers to perform operations on nested arrays and array keys of variable depth.
Image core/lib/Drupal/Component/Utility/Image.php Provides helpers to operate on images.
Html core/lib/Drupal/Component/Utility/Html.php Provides DOMDocument helpers for parsing and serializing HTML strings.
FrontMatter core/lib/Drupal/Component/FrontMatter/FrontMatter.php Component for parsing front matter from a source.
DiffArray core/lib/Drupal/Component/Utility/DiffArray.php Provides helpers to perform diffs on multi dimensional arrays.
Crypt core/lib/Drupal/Component/Utility/Crypt.php Utility class for cryptographically-secure string handling routines.