Phalcon support
NOTE
All classes are prefixed with Phalcon
Support\Collection¶
-
Namespace
Phalcon\Support
-
Uses
ArrayAccessArrayIteratorCountableInvalidArgumentExceptionIteratorAggregateJsonSerializablePhalcon\Contracts\Support\CollectionPhalcon\Support\Collection\CollectionInterfacePhalcon\Support\Helper\Json\EncodeTraversable
-
Extends
-
Implements
CollectionInterfaceCountableJsonSerializable
Phalcon\Support\Collection is a supercharged object-oriented array. It implements: - ArrayAccess - Countable - IteratorAggregate - JsonSerializable
It can be used in any part of the application that needs collection of data Such implementations are for instance accessing globals $_GET, $_POST etc.
@phpstan-template T
@property array $data @property bool $insensitive @property array $lowerKeys @property bool $strictNull @property string|null $type
Properties¶
/**
* @var array
*/
protected $data;
/**
* @var bool
*/
protected $insensitive = true;
/**
* @var array
*/
protected $lowerKeys;
/**
* @var bool
*/
protected $strictNull = false;
/**
* @var string|null
*/
protected $type;
Methods¶
public function __construct( array $data = [], bool $insensitive = bool, bool $strictNull = bool, string $type = null );
@phpstan-param array
@phpstan-param callable(T, array-key): mixed $callback
Returns a new collection of items for which the callback returns true. Keys are preserved.@phpstan-param callable(T, array-key): bool $callback @phpstan-return static
@phpstan-return T|null
Get the element from the collection@phpstan-return T|mixed
Returns the iterator of the class Returns the keys (insensitive or not) of the collection.@deprecated Use {@see self::keys()} instead. Will be removed in a future major release.
Returns the configured runtime type guard, or null if none. Returns the values of the internal array.@deprecated Use {@see self::values()} instead. Will be removed in a future major release.
Get the element from the collection Initialize internal array@phpstan-param array
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
Returns the keys (insensitive or not) of the collection. Returns the last value in the collection, or null if empty.@phpstan-return T|null
Returns a new collection with the callback applied to every value. Keys are preserved.@phpstan-param callable(T, array-key): mixed $callback @phpstan-return static
@link https://php.net/manual/en/arrayaccess.offsetexists.php
Offset to retrieve@link https://php.net/manual/en/arrayaccess.offsetget.php
Offset to set@link https://php.net/manual/en/arrayaccess.offsetset.php
Offset to unset@link https://php.net/manual/en/arrayaccess.offsetunset.php
Reduces the collection to a single value using the callback. The callback receives($accumulator, $value, $key). @phpstan-param callable(mixed, T, array-key): mixed $callback
Delete the element from the collection Replaces the collection data with a new array, clearing existing data first@phpstan-param array
uasort is used. Without a callback, the comparison direction is controlled by the $order argument (SORT_ASC or SORT_DESC). @phpstan-return static
@phpstan-return array
The following options are used if none specified for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES, JSON_THROW_ON_ERROR
@see https://www.ietf.org/rfc/rfc4627.txt
BC - delegate to __unserialize() Returns the values of the internal array. Returns a new collection containing only the items whosepropertyOrMethod strictly equals $value. @phpstan-return static
@phpstan-param T $value
Validates the value against the configured$type guard. When $type is null this is a no-op. Scalar tokens (int, string, bool, float, array, object) map to their is_* checks; anything else is treated as a class/interface name and tested with instanceof. Support\Collection\CollectionInterface
¶
-
Namespace
Phalcon\Support\Collection
-
Uses
Phalcon\Contracts\Support\Collection
-
Extends
CollectionContract -
Implements
Phalcon\Support\Collection\CollectionInterface
@psalm-suppress DeprecatedInterface @deprecated Will be removed in a future major release. Use {@see \Phalcon\Contracts\Support\Collection} instead.
Support\Collection\Exception¶
-
Namespace
Phalcon\Support\Collection
-
Uses
Throwable
-
Extends
\Exception -
Implements
Exceptions for the Collection object
Support\Collection\ReadOnlyCollection¶
-
Namespace
Phalcon\Support\Collection
-
Uses
Phalcon\Support\Collection
-
Extends
Collection -
Implements
A read only Collection object
Properties¶
Methods¶
public function __construct( array $data = [], bool $insensitive = bool, bool $strictNull = bool, string $type = null );
Temporarily disables the read-only guard so the parent class can restore the collection state. The guard is re-enabled before the method returns.
@throws Exception @throws Exception Delete the element from the collection Replaces the collection data with a new array Set an element in the collectionSupport\Debug¶
-
Namespace
Phalcon\Support
-
Uses
ErrorExceptionPhalcon\Support\Debug\ExceptionReflectionClassReflectionExceptionReflectionFunctionThrowable
-
Extends
-
Implements
Provides debug capabilities to Phalcon applications
Properties¶
/**
* @var array
*/
protected $blacklist;
/**
* @var array
*/
protected $data;
/**
* @var bool
*/
protected $hideDocumentRoot = false;
/**
* @var bool
*/
protected static $isActive = false;
/**
* @var bool
*/
protected $showBackTrace = true;
/**
* @var bool
*/
protected $showFileFragment = false;
/**
* @var bool
*/
protected $showFiles = true;
/**
* @var string
*/
protected $uri = https://assets.phalcon.io/debug/5.0.x/;
Methods¶
Clears are variables added previously Adds a variable to the debug output Returns the CSS sources Returns the JavaScript sources Generates a link to the current version documentation Halts the request showing a backtrace@throws Exception
Listen for uncaught exceptions and non silent notices or warnings Listen for uncaught exceptions Listen for non silent notices or warnings Handles uncaught exceptionspublic function onUncaughtLowSeverity( mixed $severity, mixed $message, mixed $file, mixed $line ): void;
Support\Debug\Dump¶
-
Namespace
Phalcon\Support\Debug
-
Uses
Phalcon\Di\DiInterfacePhalcon\Support\Helper\Json\EncodeReflectionReflectionClassReflectionPropertystdClass
-
Extends
-
Implements
Dumps information about a variable(s)
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
Properties¶
/**
* @var bool
*/
protected $detailed = false;
/**
* @var array
*/
protected $methods;
/**
* @var array
*/
protected $styles;
/**
* @var Encode
*/
private $encode;
Methods¶
Phalcon\Debug\Dump constructor Alias of variables() method Alias of variable() method Set styles for vars type Returns an JSON string of information about a single variable.$foo = [
"key" => "value",
];
echo (new \Phalcon\Debug\Dump())->toJson($foo);
$foo = new stdClass();
$foo->bar = "buz";
echo (new \Phalcon\Debug\Dump())->toJson($foo);
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
Support\Debug\Exception¶
-
Namespace
Phalcon\Support\Debug
-
Uses
Phalcon\Support\Exception
-
Extends
SupportException -
Implements
Exceptions thrown in Phalcon\Debug will use this class
Support\Exception¶
-
Namespace
Phalcon\Support
-
Uses
-
Extends
\Exception -
Implements
Phalcon\Support\Exception
Support\Helper\Arr\AbstractArr
¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Abstract class offering methods to help with the Arr namespace. This can be moved to a trait once Zephir supports it.
@todo move to trait when there is support for it
Methods¶
Helper method to filter the collectionSupport\Helper\Arr\Blacklist¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Black list filter by key: exclude elements of an array by the keys obtained from the elements of a blacklist
Methods¶
Support\Helper\Arr\Chunk¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Chunks an array into smaller arrays of a specified size.
Methods¶
Support\Helper\Arr\Filter¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Filters a collection using array_filter and using the callable (if defined)
Methods¶
Support\Helper\Arr\First¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns the first element of the collection. If a callable is passed, the element returned is the first that validates true
Methods¶
Support\Helper\Arr\FirstKey¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns the key of the first element of the collection. If a callable is passed, the element returned is the first that validates true
Methods¶
Support\Helper\Arr\Flatten¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Flattens an array up to the one level depth, unless $deep is set to true
Methods¶
Support\Helper\Arr\Get¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Gets an array element by key and if it does not exist returns the default. It also allows for casting the returned value to a specific type using settype internally
Methods¶
public function __invoke( array $collection, mixed $index, mixed $defaultValue = null, string $cast = null ): mixed;
Support\Helper\Arr\Group¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Groups the elements of an array based on the passed callable
Methods¶
Support\Helper\Arr\Has¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Checks an array if it has an element with a specific key and returns true/false accordingly
Methods¶
Support\Helper\Arr\IsUnique¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Checks a flat list for duplicate values. Returns true if duplicate values exist and false if values are all unique.
Methods¶
Support\Helper\Arr\Last¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns the last element of the collection. If a callable is passed, the element returned is the first that validates true
Methods¶
Support\Helper\Arr\LastKey¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns the key of the last element of the collection. If a callable is passed, the element returned is the first that validates true
Methods¶
Support\Helper\Arr\Order¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Sorts a collection of arrays or objects by an attribute of the object. It supports ascending/descending sorts but also flags that are identical to the ones used by ksort and krsort
Constants¶
Methods¶
public function __invoke( array $collection, mixed $attribute, int $order = static-constant-access, int $flags = int ): array;
Support\Helper\Arr\Pluck¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Returns a subset of the collection based on the values of the collection
Methods¶
Support\Helper\Arr\Set¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Sets an array element. Using a key is optional
Methods¶
Support\Helper\Arr\SliceLeft¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Returns a new array with n elements removed from the left.
Methods¶
Support\Helper\Arr\SliceRight¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Returns a new array with n elements removed from the right.
Methods¶
Support\Helper\Arr\Split¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Returns a new array with keys of the collection as one element and values as another
Methods¶
Support\Helper\Arr\ToObject¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
-
Implements
Returns the passed array as an object.
Methods¶
Support\Helper\Arr\ValidateAll¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns true if the provided function returns true for all elements of the collection, false otherwise.
Methods¶
Support\Helper\Arr\ValidateAny¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
Returns true if the provided function returns true for at least one element of the collection, false otherwise.
Methods¶
Support\Helper\Arr\Whitelist¶
-
Namespace
Phalcon\Support\Helper\Arr
-
Uses
-
Extends
AbstractArr -
Implements
White list filter by key: obtain elements of an array filtering by the keys obtained from the elements of a whitelist
Methods¶
Support\Helper\Exception¶
-
Namespace
Phalcon\Support\Helper
-
Uses
-
Extends
\Exception -
Implements
-
Phalcon\Support\Exception */
Support\Helper\File\Basename¶
-
Namespace
Phalcon\Support\Helper\File
-
Uses
-
Extends
-
Implements
Gets the filename from a given path, Same as PHP's basename() but has non-ASCII support. PHP's basename() does not properly support streams or filenames beginning with a non-US-ASCII character.
Methods¶
@see https://bugs.php.net/bug.php?id=37738Support\Helper\Json\Decode¶
-
Namespace
Phalcon\Support\Helper\Json
-
Uses
InvalidArgumentException
-
Extends
-
Implements
Decodes a string using json_decode and throws an exception if the JSON data cannot be decoded
The following options are used if none specified for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES
Any error will throw InvalidArgumentException, regardless of whether JSON_THROW_ON_ERROR is specified in the options.
Methods¶
public function __invoke( string $data, bool $associative = bool, int $depth = int, int $options = int );
Support\Helper\Json\Encode¶
-
Namespace
Phalcon\Support\Helper\Json
-
Uses
InvalidArgumentException
-
Extends
-
Implements
Encodes a string using json_encode and throws an exception if the JSON data cannot be encoded
The following options are used if none specified for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES
Any error will throw InvalidArgumentException, regardless of whether JSON_THROW_ON_ERROR is specified in the options.
@see https://www.ietf.org/rfc/rfc4627.txt
Methods¶
Support\Helper\Number\IsBetween¶
-
Namespace
Phalcon\Support\Helper\Number
-
Uses
-
Extends
-
Implements
Checks if a number is within a range
Methods¶
Support\Helper\Str\AbstractStr
¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Abstract class offering methods to help with the Str namespace. This can be moved to a trait once Zephir supports it.
@todo move to trait when there is support for it
Methods¶
Check if a string ends with a given stringprotected function toInterpolate( string $input, array $context = [], string $left = string, string $right = string ): string;
@see https://www.php-fig.org/psr/psr-3/ Section 1.2 Message
Lowercases a string using mbstring Check if a string starts with a given string Uppercases a string using mbstringSupport\Helper\Str\Camelize¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
PascalCase -
Implements
Converts strings to upperCamelCase or lowerCamelCase
Methods¶
public function __invoke( string $text, string $delimiters = null, bool $lowerFirst = bool ): string;
Support\Helper\Str\Concat¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
Phalcon\Support\Helper\Exception
-
Extends
AbstractStr -
Implements
Concatenates strings using the separator only once without duplication in places concatenation
Methods¶
Support\Helper\Str\CountVowels¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Returns number of vowels in provided string. Uses a regular expression to count the number of vowels (A, E, I, O, U) in a string.
Methods¶
Support\Helper\Str\Decapitalize¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Decapitalizes the first letter of the string and then adds it with rest of the string. Omit the upperRest parameter to keep the rest of the string intact, or set it to true to convert to uppercase.
Methods¶
public function __invoke( string $text, bool $upperRest = bool, string $encoding = string ): string;
Support\Helper\Str\Decrement¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Removes a number from the end of a string or decrements that number if it is already defined
Methods¶
Support\Helper\Str\DirFromFile¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Accepts a file name (without extension) and returns a calculated directory structure with the filename in the end
Methods¶
Support\Helper\Str\DirSeparator¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Accepts a directory name and ensures that it ends with DIRECTORY_SEPARATOR
Methods¶
Support\Helper\Str\Dynamic¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
RuntimeException
-
Extends
-
Implements
Generates random text in accordance with the template. The template is defined by the left and right delimiter and it can contain values separated by the separator
Methods¶
public function __invoke( string $text, string $leftDelimiter = string, string $rightDelimiter = string, string $separator = string ): string;
Support\Helper\Str\EndsWith¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Check if a string ends with a given string
Methods¶
Support\Helper\Str\FirstBetween¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Returns the first string there is between the strings from the parameter start and end.
Methods¶
Support\Helper\Str\Friendly¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
Phalcon\Support\Helper\Exception
-
Extends
AbstractStr -
Implements
Changes a text to a URL friendly one. Replaces commonly known accented characters with their Latin equivalents. If a replace string or array is passed, it will also be used to replace those characters with a space.
Methods¶
public function __invoke( string $text, string $separator = string, bool $lowercase = bool, mixed $replace = null ): string;
Support\Helper\Str\Humanize¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Makes an underscored or dashed text human-readable
Methods¶
Support\Helper\Str\Includes¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Determines whether a string includes another string or not.
Methods¶
Support\Helper\Str\Increment¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Adds a number to the end of a string or increments that number if it is already defined
Methods¶
Support\Helper\Str\Interpolate¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Interpolates context values into the message placeholders. By default, the right and left tokens are %
@see https://www.php-fig.org/psr/psr-3/ Section 1.2 Message
Methods¶
public function __invoke( string $message, array $context = [], string $leftToken = string, string $rightToken = string ): string;
Support\Helper\Str\IsAnagram¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Compare two strings and returns true if both strings are anagram, false otherwise.
Methods¶
Support\Helper\Str\IsLower¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Returns true if the given string is in lower case, false otherwise.
Methods¶
Support\Helper\Str\IsPalindrome¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Returns true if the given string is a palindrome, false otherwise.
Methods¶
Support\Helper\Str\IsUpper¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Returns true if the given string is in upper case, false otherwise.
Methods¶
Support\Helper\Str\KebabCase¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
PascalCase -
Implements
Converts strings to kebab-case style
Methods¶
Support\Helper\Str\Len¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Calculates the length of the string using mb_strlen
Methods¶
Support\Helper\Str\Lower¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Converts a string to lowercase using mbstring
Methods¶
Support\Helper\Str\PascalCase¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Converts strings to PascalCase style
Methods¶
Support\Helper\Str\Prefix¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Prefixes the text with the supplied prefix
Methods¶
Support\Helper\Str\Random¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Generates a random string based on the given type. Type is one of the RANDOM_* constants
Constants¶
const RANDOM_ALNUM = 0;
const RANDOM_ALPHA = 1;
const RANDOM_DISTINCT = 5;
const RANDOM_HEXDEC = 2;
const RANDOM_NOZERO = 4;
const RANDOM_NUMERIC = 3;
Methods¶
Support\Helper\Str\ReduceSlashes¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Reduces multiple slashes in a string to single slashes
Methods¶
Support\Helper\Str\SnakeCase¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
PascalCase -
Implements
Converts strings to snake_case style
Methods¶
Support\Helper\Str\StartsWith¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Check if a string starts with a given string
Methods¶
Support\Helper\Str\Suffix¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Suffixes the text with the supplied suffix
Methods¶
Support\Helper\Str\Ucwords¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Capitalizes the first letter of each word
Methods¶
Support\Helper\Str\Uncamelize¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Converts strings to non camelized style
Methods¶
Support\Helper\Str\Underscore¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
-
Implements
Makes a text underscored instead of spaced
Methods¶
Support\Helper\Str\Upper¶
-
Namespace
Phalcon\Support\Helper\Str
-
Uses
-
Extends
AbstractStr -
Implements
Converts a string to uppercase using mbstring
Methods¶
Support\HelperFactory¶
-
Namespace
Phalcon\Support
-
Uses
Phalcon\Factory\AbstractFactory
-
Extends
AbstractFactory -
Implements
ServiceLocator implementation for helpers
@method string basename(string $uri, string $suffix = null) @method array blacklist(array $collection, array $blackList) @method string camelize(string $text, string $delimiters = null, bool $lowerFirst = false) @method array chunk(array $collection, int $size, bool $preserveKeys = false) @method string concat(string $delimiter, string $first, string $second, string ...$arguments) @method int countVowels(string $text) @method string decapitalize(string $text, bool $upperRest = false, string $encoding = 'UTF-8') @method string decode(string $data, bool $associative = false, int $depth = 512, int $options = 0) @method string decrement(string $text, string $separator = '') @method string dirFromFile(string $file) @method string dirSeparator(string $directory) @method string dynamic(string $text, string $leftDelimiter = "{", string $rightDelimiter = "}", string $separator = "|") @method string encode($data, int $options = 0, int $depth = 512) @method bool endsWith(string $haystack, string $needle, bool $ignoreCase = true) @method mixed filter(array $collection, callable|null $method) @method mixed first(array $collection, callable $method = null) @method string firstBetween(string $text, string $start, string $end) @method mixed firstKey(array $collection, callable $method = null) @method string friendly(string $text, string $separator = '-', bool $lowercase = true, $replace = null) @method array flatten(array $collection, bool $deep = false) @method mixed get(array $collection, $index, $defaultValue = null, string $cast = null) @method array group(array $collection, $method) @method bool has(array $collection, $index) @method string humanize(string $text) @method bool includes(string $haystack, string $needle) @method string increment(string $text, string $separator = '') @method string interpolate(string $message, array $context = [], string $leftToken = "%", string $rightToken = "%") @method bool isAnagram(string $first, string $second) @method bool isBetween(int $value, int $start, int $end) @method bool isLower(string $text, string $encoding = 'UTF-8') @method bool isPalindrome(string $text) @method bool isUnique(array $collection) @method bool isUpper(string $text, string $encoding = 'UTF-8') @method string kebabCase(string $text, string $delimiters = null) @method mixed last(array $collection, callable $method = null) @method mixed lastKey(array $collection, callable $method = null) @method int len(string $text, string $encoding = 'UTF-8') @method string lower(string $text, string $encoding = 'UTF-8') @method array order(array $collection, $attribute, string $order = 'asc') @method string pascalCase(string $text, string $delimiters = null) @method array pluck(array $collection, string $element) @method string prefix($text, string $prefix) @method string random(int $type = 0, int $length = 8) @method string reduceSlashes(string $text) @method array set(array $collection, $value, $index = null) @method array sliceLeft(array $collection, int $elements = 1) @method array sliceRight(array $collection, int $elements = 1) @method string snakeCase(string $text, string $delimiters = null) @method array split(array $collection) @method bool startsWith(string $haystack, string $needle, bool $ignoreCase = true) @method string suffix($text, string $suffix) @method object toObject(array $collection) @method bool validateAll(array $collection, callable $method) @method bool validateAny(array $collection, callable $method) @method string ucwords(string $text, string $encoding = 'UTF-8') @method string uncamelize(string $text, string $delimiters = '_') @method string underscore(string $text) @method string upper(string $text, string $encoding = 'UTF-8') @method array whitelist(array $collection, array $whiteList)
Methods¶
FactoryTrait constructor. Returns the available adaptersSupport\Registry
¶
-
Namespace
Phalcon\Support
-
Uses
Phalcon\Support\CollectionTraversable
-
Extends
Collection -
Implements
Phalcon\Registry
A registry is a container for storing objects and values in the application space. By storing the value in a registry, the same object is always available throughout your application.
$registry = new \Phalcon\Registry();
// Set value
$registry->something = "something";
// or
$registry["something"] = "something";
// Get value
$value = $registry->something;
// or
$value = $registry["something"];
// Check if the key exists
$exists = isset($registry->something);
// or
$exists = isset($registry["something"]);
// Unset
unset($registry->something);
// or
unset($registry["something"]);
In addition to ArrayAccess, Phalcon\Registry also implements Countable (count($registry) will return the number of elements in the registry), Serializable and Iterator (you can iterate over the registry using a foreach loop) interfaces. For PHP 5.4 and higher, JsonSerializable interface is implemented.
Phalcon\Registry is very fast (it is typically faster than any userspace implementation of the registry); however, this comes at a price: Phalcon\Registry is a final class and cannot be inherited from.
Though Phalcon\Registry exposes methods like __get(), offsetGet(), count() etc, it is not recommended to invoke them manually (these methods exist mainly to match the interfaces the registry implements): $registry->__get("property") is several times slower than $registry->property.
Internally all the magic methods (and interfaces except JsonSerializable) are implemented using object handlers or similar techniques: this allows to bypass relatively slow method calls.
Methods¶
Constructor Magic getter to get an element from the collection Magic isset to check whether an element exists or not Magic setter to assign values to an element Magic unset to remove an element from the collection Clears the internal collection Count elements of an object@link https://php.net/manual/en/countable.count.php
final public function get( string $element, mixed $defaultValue = null, string $cast = null ): mixed;
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
Whether a offset exists@link https://php.net/manual/en/arrayaccess.offsetexists.php
Offset to retrieve@link https://php.net/manual/en/arrayaccess.offsetget.php
Offset to set@link https://php.net/manual/en/arrayaccess.offsetset.php
Offset to unset@link https://php.net/manual/en/arrayaccess.offsetunset.php
Delete the element from the collection String representation of object@link https://php.net/manual/en/serializable.serialize.php
Set an element in the collection Returns the object in an array format Returns the object in a JSON formatThe default string uses the following options for json_encode
JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, JSON_UNESCAPED_SLASHES
@see https://www.ietf.org/rfc/rfc4627.txt
Constructs the object@link https://php.net/manual/en/serializable.unserialize.php
Support\Settings¶
-
Namespace
Phalcon\Support
-
Uses
-
Extends
-
Implements
Phalcon\Support\Settings
Provides a PHP-userland layer for reading and overriding the Phalcon extension's ini settings (orm., db., form.*).
get() checks PHP-level overrides first, then falls back to globals_get() which reads the value configured in php.ini / .htaccess / per-virtualhost.
set() stores the value in the PHP-level overrides array only. It does NOT call globals_set(), so the change is confined to this static state and never modifies the underlying C struct. This prevents settings changed by one project from leaking into another project sharing the same PHP worker process.
NOTE: In non-ZTS (non-thread-safe) PHP builds, globals_get() reads from a process-level C struct. Because set() does not write to that struct, any value set via ini_set("phalcon.orm.*", ...) or globals_set() by other code remains visible through get() as the fallback for keys that have no PHP-level override. In ZTS builds each thread has its own copy of the struct.
reset() clears only the keys that were previously set via set(), restoring those keys to their globals_get() fallback values.
Properties¶
/**
* PHP-level overrides. Keys stored here take priority over globals_get().
*
* @var array
*/
protected static $overrides;
Methods¶
Returns the value of a known setting.Resolution order: 1. PHP-level override (set via Settings::set()) 2. globals_get() — the C-level value, honouring php.ini / .htaccess 3. null — for unknown keys
Clears all PHP-level overrides, restoring get() to return globals_get() fallback values (as configured in php.ini or .htaccess). Overrides a setting at the PHP level.Does NOT call globals_set(), so the C-level struct is not modified and no other project sharing this PHP process is affected.
Unknown keys are silently ignored.
Support\Version¶
-
Namespace
Phalcon\Support
-
Uses
-
Extends
-
Implements
This class allows to get the installed version of the framework
Constants¶
const VERSION_MAJOR = 0;
const VERSION_MEDIUM = 1;
const VERSION_MINOR = 2;
const VERSION_SPECIAL = 3;
const VERSION_SPECIAL_NUMBER = 4;
Methods¶
Returns the active version (string) Returns the numeric active version Returns a specific part of the version. If the wrong parameter is passed it will return the full version Area where the version number is set. The format is as follows: ABBCCDEA - Major version B - Med version (two digits) C - Min version (two digits) D - Special release: 1 = alpha, 2 = beta, 3 = RC, 4 = stable E - Special release version i.e. RC1, Beta2 etc.