Phalcon support
NOTE
All classes are prefixed with Phalcon
Support\AbstractLocator¶
Abstract Source on GitHub
Abstract base class for service locators.
Provides a unified way to register, validate, and resolve services from a DI container, with support for both legacy Di and new Container.
@template T of object
Phalcon\Support\AbstractLocator
Uses Phalcon\Contracts\Container\Service\Collection · Phalcon\Di\DiInterface · Throwable
Method Summary¶
public
__construct(mixed $container,array $services = [])
public
array
getAll()
Returns the full registered service map (defaults plus any added via
public
string
getClass( string $name )
Returns the class-string registered under the given name.
public
bool
has( string $name )
Whether a service with the given name is registered.
public
object
newInstance( string $name )
Retrieve a service instance from the container.
public
static
register(string $name,string $definition)
Register a service or override an existing one.
protected
string
getExceptionClass()
Get the exception class to throw on errors.
protected
string
getInterfaceClass()
Get the interface/class that all registered services must implement.
protected
string
getService( string $name )
Get the service class name for a given name.
protected
array
getServices()
Get the default services for this locator.
Properties¶
protected
Collection|DiInterface
$container
protected
array
$services = []
Methods¶
__construct()¶
getAll()¶
Returns the full registered service map (defaults plus any added via register()).
getClass()¶
Returns the class-string registered under the given name.
has()¶
Whether a service with the given name is registered.
newInstance()¶
Retrieve a service instance from the container.
On the DiInterface path this returns the container's shared
instance (getShared()) - despite the name, it is not a fresh build.
Locators whose services carry per-activation state should override this
method to resolve a fresh instance; see Auth\Access\AccessLocator, which uses
ContainerResolver::resolveFresh for exactly that reason.
register()¶
Register a service or override an existing one.
getExceptionClass()¶
Get the exception class to throw on errors.
getInterfaceClass()¶
Get the interface/class that all registered services must implement. This allows different locators to enforce different contracts.
getService()¶
Get the service class name for a given name.
getServices()¶
Get the default services for this locator.
Support\Collection¶
Class Source on GitHub
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.
@property array $data @property bool $insensitive @property array $lowerKeys @property bool $strictNull @property string|null $type
Phalcon\Support\Collection- implementsPhalcon\Support\Collection\CollectionInterface,Countable,JsonSerializable
Uses ArrayAccess · ArrayIterator · Countable · InvalidArgumentException · IteratorAggregate · JsonSerializable · Phalcon\Support\Collection\CollectionInterface · Phalcon\Support\Collection\Exceptions\InvalidValueType · Phalcon\Support\Helper\Json\Encode · Traversable
Method Summary¶
public
__construct(array $data = [],bool $insensitive = true,bool $strictNull = false,string $type = null)
Collection constructor.
public
mixed
__get( string $element )
Magic getter to get an element from the collection
public
bool
__isset( string $element )
Magic isset to check whether an element exists or not
public
array
__serialize()
Returns the state of the collection for serialization, including
public
void
__set(string $element,mixed $value)
Magic setter to assign values to an element
public
void
__unserialize( array $data )
Restores the collection state. Accepts both the structured format
public
void
__unset( string $element )
Magic unset to remove an element from the collection
public
void
clear()
Clears the internal collection
public
array
column( string $propertyOrMethod )
Returns the values from a single property/method extracted from every
public
int
count()
Count elements of an object
public
static
each( callable $callback )
Invokes the callback for every item in the collection. Returns the
public
static
filter( callable $callback )
Returns a new collection of items for which the callback returns true.
public
mixed
first()
Returns the first value in the collection, or null if empty.
public
mixed
get(string $element,mixed $defaultValue = null,string $cast = null)
Get the element from the collection
public
Traversable
getIterator()
Returns the iterator of the class
public
array
getKeys( bool $insensitive = true )
Returns the keys (insensitive or not) of the collection.
public
string|null
getType()
Returns the configured runtime type guard, or null if none.
public
array
getValues()
Returns the values of the internal array.
public
bool
has( string $element )
Get the element from the collection
public
void
init( array $data = [] )
Initialize internal array
public
bool
isEmpty()
Return if the collection is empty
public
array
jsonSerialize()
Specify data which should be serialized to JSON
public
array
keys( bool $insensitive = true )
Returns the keys (insensitive or not) of the collection.
public
mixed
last()
Returns the last value in the collection, or null if empty.
public
static
map( callable $callback )
Returns a new collection with the callback applied to every value.
public
bool
offsetExists( mixed $element )
Whether a offset exists
public
mixed
offsetGet( mixed $element )
Offset to retrieve
public
void
offsetSet(mixed $element,mixed $value)
Offset to set
public
void
offsetUnset( mixed $element )
Offset to unset
public
mixed
reduce(callable $callback,mixed $initial = null)
Reduces the collection to a single value using the callback. The
public
void
remove( string $element )
Delete the element from the collection
public
void
replace( array $data )
Replaces the collection data with a new array, clearing existing data first
public
string|null
serialize()
BC - delegate to __serialize()
public
void
set(string $element,mixed $value)
Set an element in the collection
public
static
sort(mixed $callback = null,int $order = 4)
Returns a new collection sorted by value. Keys are preserved. When a
public
array
toArray()
Returns the object in an array format
public
string
toJson( int $options = 4194383 )
Returns the object in a JSON format
public
void
unserialize( string $data )
BC - delegate to __unserialize()
public
array
values()
Returns the values of the internal array.
public
static
where(string $propertyOrMethod,mixed $value)
Returns a new collection containing only the items whose
protected
static
cloneEmpty( array $data = [] )
Builds a new collection of the same concrete class, carrying over the
protected
mixed
extractValue(mixed $item,string $propertyOrMethod)
Extracts a single value from an item. For arrays returns the keyed
protected
string
processKey( string $element )
Checks if we need insensitive keys and if so, converts the element to
protected
void
setData(string $element,mixed $value)
Internal method to set data
protected
void
validateType( mixed $value )
Validates the value against the configured $type guard. When $type
Properties¶
protected
array
$data = []
protected
bool
$insensitive = true
protected
array
$lowerKeys = []
protected
bool
$strictNull = false
protected
string|null
$type = null
Methods¶
__construct()¶
public function __construct(
array $data = [],
bool $insensitive = true,
bool $strictNull = false,
string $type = null
);
Collection constructor.
__get()¶
Magic getter to get an element from the collection
__isset()¶
Magic isset to check whether an element exists or not
__serialize()¶
Returns the state of the collection for serialization, including configuration flags so the round-trip restores full state.
__set()¶
Magic setter to assign values to an element
__unserialize()¶
Restores the collection state. Accepts both the structured format emitted by __serialize() and the legacy flat-array format for BC with previously serialized data.
__unset()¶
Magic unset to remove an element from the collection
clear()¶
Clears the internal collection
column()¶
Returns the values from a single property/method extracted from every item in the collection, keyed by the original collection key.
count()¶
Count elements of an object
each()¶
Invokes the callback for every item in the collection. Returns the collection itself to allow chaining.
filter()¶
Returns a new collection of items for which the callback returns true. Keys are preserved.
first()¶
Returns the first value in the collection, or null if empty.
get()¶
Get the element from the collection
getIterator()¶
Returns the iterator of the class
getKeys()¶
Returns the keys (insensitive or not) of the collection.
getType()¶
Returns the configured runtime type guard, or null if none.
getValues()¶
Returns the values of the internal array.
has()¶
Get the element from the collection
init()¶
Initialize internal array
isEmpty()¶
Return if the collection is empty
jsonSerialize()¶
Specify data which should be serialized to JSON
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
keys()¶
Returns the keys (insensitive or not) of the collection.
last()¶
Returns the last value in the collection, or null if empty.
map()¶
Returns a new collection with the callback applied to every value. Keys are preserved.
offsetExists()¶
Whether a offset exists
@link https://php.net/manual/en/arrayaccess.offsetexists.php
offsetGet()¶
Offset to retrieve
@link https://php.net/manual/en/arrayaccess.offsetget.php
offsetSet()¶
Offset to set
@link https://php.net/manual/en/arrayaccess.offsetset.php
offsetUnset()¶
Offset to unset
@link https://php.net/manual/en/arrayaccess.offsetunset.php
reduce()¶
Reduces the collection to a single value using the callback. The
callback receives ($accumulator, $value, $key).
remove()¶
Delete the element from the collection
replace()¶
Replaces the collection data with a new array, clearing existing data first
serialize()¶
BC - delegate to __serialize()
set()¶
Set an element in the collection
sort()¶
Returns a new collection sorted by value. Keys are preserved. When a
callback is supplied, uasort is used. Without a callback, the
comparison direction is controlled by the $order argument
(SORT_ASC or SORT_DESC).
toArray()¶
Returns the object in an array format
toJson()¶
Returns the object in a JSON format
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
unserialize()¶
BC - delegate to __unserialize()
values()¶
Returns the values of the internal array.
where()¶
Returns a new collection containing only the items whose
propertyOrMethod strictly equals $value.
cloneEmpty()¶
Builds a new collection of the same concrete class, carrying over the configuration (insensitivity, strict-null, type) of the current one.
extractValue()¶
Extracts a single value from an item. For arrays returns the keyed entry; for objects, prefers a callable method, then a readable property. Returns null when nothing matches.
processKey()¶
Checks if we need insensitive keys and if so, converts the element to lowercase
setData()¶
Internal method to set data
validateType()¶
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¶
Interface Source on GitHub
Phalcon\Support\Collection\CollectionInterface
ArrayAccessPhalcon\Contracts\Support\CollectionPhalcon\Support\Collection\CollectionInterface
Uses Phalcon\Contracts\Support\Collection
Support\Collection\Exception¶
Class Source on GitHub
Exceptions for the Collection object
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Collection\Exception
Uses Phalcon\Support\Exception
Support\Collection\Exceptions\InvalidValueType¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\Support\Collection\Exceptions\InvalidValueType
Uses InvalidArgumentException
Method Summary¶
Methods¶
__construct()¶
Support\Collection\Exceptions\ReadOnlyViolation¶
Class Source on GitHub
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Collection\ExceptionPhalcon\Support\Collection\Exceptions\ReadOnlyViolation
Uses Phalcon\Support\Collection\Exception
Method Summary¶
Methods¶
__construct()¶
Support\Collection\ReadOnlyCollection¶
Class Source on GitHub
A read only Collection object
Phalcon\Support\CollectionPhalcon\Support\Collection\ReadOnlyCollection
Uses Phalcon\Support\Collection · Phalcon\Support\Collection\Exceptions\ReadOnlyViolation
Method Summary¶
public
__construct(array $data = [],bool $insensitive = true,bool $strictNull = false,string $type = null)
ReadOnlyCollection constructor.
public
void
__unserialize( array $data )
Restores the collection state during unserialization.
public
void
clear()
public
void
init( array $data = [] )
public
void
remove( string $element )
Delete the element from the collection
public
void
replace( array $data )
Replaces the collection data with a new array
public
void
set(string $element,mixed $value)
Set an element in the collection
Properties¶
protected
bool
$constructed = false
Methods¶
__construct()¶
public function __construct(
array $data = [],
bool $insensitive = true,
bool $strictNull = false,
string $type = null
);
ReadOnlyCollection constructor.
__unserialize()¶
Restores the collection state during unserialization.
Temporarily disables the read-only guard so the parent class can restore the collection state. The guard is re-enabled before the method returns.
clear()¶
init()¶
remove()¶
Delete the element from the collection
replace()¶
Replaces the collection data with a new array
set()¶
Set an element in the collection
Support\Debug¶
Class Source on GitHub
Provides debug capabilities to Phalcon applications
Phalcon\Support\Debug
Uses Phalcon\Support\Debug\Exceptions\RequestHalted · Phalcon\Support\Debug\Exceptions\RuntimeWarning · ReflectionClass · ReflectionException · ReflectionFunction · Throwable
Method Summary¶
public
static
clearVars()
Clears are variables added previously
public
static
debugVar( mixed $varz )
Adds a variable to the debug output
public
string
getCssSources()
Returns the CSS sources
public
string
getJsSources()
Returns the JavaScript sources
public
string
getVersion()
Generates a link to the current version documentation
public
void
halt()
Halts the request showing a backtrace
public
static
listen(bool $exceptions = true,bool $lowSeverity = false)
Listen for uncaught exceptions and non silent notices or warnings
public
static
listenExceptions()
Listen for uncaught exceptions
public
static
listenLowSeverity()
Listen for non silent notices or warnings
public
bool
onUncaughtException( \Throwable $exception )
Handles uncaught exceptions
public
void
onUncaughtLowSeverity(mixed $severity,mixed $message,mixed $file,mixed $line)
Throws an exception when a notice or warning is raised
public
string
renderHtml( \Throwable $exception )
Render exception to html format.
public
static
setBlacklist( array $blacklist )
Sets if files the exception's backtrace must be showed
public
static
setShowBackTrace( bool $showBackTrace )
Sets if files the exception's backtrace must be showed
public
static
setShowFileFragment( bool $showFileFragment )
Sets if files must be completely opened and showed in the output
public
static
setShowFiles( bool $showFiles )
Set if files part of the backtrace must be shown in the output
public
static
setUri( string $uri )
Change the base URI for static resources
protected
string
escapeString( string $value )
Escapes a string with htmlentities
protected
string|null
getArrayDump(array $argument,mixed $n = 0)
Produces a recursive representation of an array
protected
string
getVarDump( mixed $variable )
Produces an string representation of a variable
protected
string
showTraceItem(int $number,array $trace)
Shows a backtrace item
Properties¶
protected
array
$blacklist = [...]
protected
array
$data = []
protected
bool
$hideDocumentRoot = false
protected
bool
$isActive = false
protected
bool
$showBackTrace = true
protected
bool
$showFileFragment = false
protected
bool
$showFiles = true
protected
string
$uri = "https://assets.phalcon.io/debug/5.0.x/"
Methods¶
clearVars()¶
Clears are variables added previously
debugVar()¶
Adds a variable to the debug output
getCssSources()¶
Returns the CSS sources
getJsSources()¶
Returns the JavaScript sources
getVersion()¶
Generates a link to the current version documentation
halt()¶
Halts the request showing a backtrace
listen()¶
Listen for uncaught exceptions and non silent notices or warnings
listenExceptions()¶
Listen for uncaught exceptions
listenLowSeverity()¶
Listen for non silent notices or warnings
onUncaughtException()¶
Handles uncaught exceptions
onUncaughtLowSeverity()¶
public function onUncaughtLowSeverity(
mixed $severity,
mixed $message,
mixed $file,
mixed $line
): void;
Throws an exception when a notice or warning is raised
renderHtml()¶
Render exception to html format.
setBlacklist()¶
Sets if files the exception's backtrace must be showed
setShowBackTrace()¶
Sets if files the exception's backtrace must be showed
setShowFileFragment()¶
Sets if files must be completely opened and showed in the output or just the fragment related to the exception
setShowFiles()¶
Set if files part of the backtrace must be shown in the output
setUri()¶
Change the base URI for static resources
escapeString()¶
Escapes a string with htmlentities
getArrayDump()¶
Produces a recursive representation of an array
getVarDump()¶
Produces an string representation of a variable
showTraceItem()¶
Shows a backtrace item
Support\Debug\Dump¶
Class Source on GitHub
Dumps information about a variable(s)
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
Phalcon\Support\Debug\Dump
Uses Phalcon\Di\DiInterface · Phalcon\Support\Helper\Json\Encode · Reflection · ReflectionClass · ReflectionProperty · stdClass
Method Summary¶
public
__construct(array $styles = [],bool $detailed = false)
Phalcon\Debug\Dump constructor
public
string
all()
Alias of variables() method
public
bool
getDetailed()
public
string
one(mixed $variable,string $name = null)
Alias of variable() method
public
void
setDetailed( bool $flag )
public
array
setStyles( array $styles = [] )
Set styles for vars type
public
string
toJson( mixed $variable )
Returns an JSON string of information about a single variable.
public
string
variable(mixed $variable,string $name = null)
Returns an HTML string of information about a single variable.
public
string
variables()
Returns an HTML string of debugging information about any number of
protected
string
getStyle( string $type )
Get style for type
protected
string
output(mixed $variable,string $name = null,int $tab = 1)
Prepare an HTML string of information about a single variable.
Properties¶
protected
bool
$detailed = false
protected
array
$methods = []
protected
array
$styles = []
Methods¶
__construct()¶
Phalcon\Debug\Dump constructor
all()¶
Alias of variables() method
getDetailed()¶
one()¶
Alias of variable() method
setDetailed()¶
setStyles()¶
Set styles for vars type
toJson()¶
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);
variable()¶
Returns an HTML string of information about a single variable.
variables()¶
Returns an HTML string of debugging information about any number of variables, each wrapped in a "pre" tag.
$foo = "string";
$bar = ["key" => "value"];
$baz = new stdClass();
echo (new \Phalcon\Debug\Dump())->variables($foo, $bar, $baz);
getStyle()¶
Get style for type
output()¶
Prepare an HTML string of information about a single variable.
Support\Debug\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Debug will use this class
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Debug\Exception
Uses Phalcon\Support\Exception
Support\Debug\Exceptions\RequestHalted¶
Class Source on GitHub
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Debug\ExceptionPhalcon\Support\Debug\Exceptions\RequestHalted
Uses Phalcon\Support\Debug\Exception
Method Summary¶
Methods¶
__construct()¶
Support\Debug\Exceptions\RuntimeWarning¶
Class Source on GitHub
\ErrorExceptionPhalcon\Support\Debug\Exceptions\RuntimeWarning
Support\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Support will use this class
\ExceptionPhalcon\Support\Exception
Support\HelperFactory¶
Class Source on GitHub
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 $leftDel = "{", string $rightDel = "}", 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(string $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)
Phalcon\Factory\AbstractConfigFactoryPhalcon\Factory\AbstractFactoryPhalcon\Support\HelperFactory
Uses Phalcon\Factory\AbstractFactory
Method Summary¶
public
__call(string $name,array $arguments)
public
__construct( array $services = [] )
FactoryTrait constructor.
public
newInstance( string $name )
protected
string
getExceptionClass()
protected
array
getServices()
Returns the available adapters
Methods¶
__call()¶
__construct()¶
FactoryTrait constructor.
newInstance()¶
getExceptionClass()¶
getServices()¶
Returns the available adapters
Support\Helper\Arr\AbstractArr¶
Abstract Source on GitHub
Abstract class offering methods to help with the Arr namespace. This can be moved to a trait once Zephir supports it.
This base exists only for the Arr helper hierarchy; it is not a general
base class. New code that needs these routines should compose the relevant
invokable helper (for example Arr\Get) rather than extending it.
@internal
@todo move to trait when there is support for it
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\BlacklistPhalcon\Support\Helper\Arr\FilterPhalcon\Support\Helper\Arr\FirstPhalcon\Support\Helper\Arr\FirstKeyPhalcon\Support\Helper\Arr\LastPhalcon\Support\Helper\Arr\LastKeyPhalcon\Support\Helper\Arr\ValidateAllPhalcon\Support\Helper\Arr\ValidateAnyPhalcon\Support\Helper\Arr\Whitelist
Method Summary¶
Methods¶
toFilter()¶
Helper method to filter the collection
Support\Helper\Arr\Blacklist¶
Class Source on GitHub
Black list filter by key: exclude elements of an array by the keys obtained from the elements of a blacklist
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\Blacklist
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Chunk¶
Class Source on GitHub
Chunks an array into smaller arrays of a specified size.
Phalcon\Support\Helper\Arr\Chunk
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Filter¶
Class Source on GitHub
Filters a collection using array_filter and using the callable (if defined)
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\Filter
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\First¶
Class Source on GitHub
Returns the first element of the collection. If a callable is passed, the element returned is the first that validates true
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\First
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\FirstKey¶
Class Source on GitHub
Returns the key of the first element of the collection. If a callable is passed, the element returned is the first that validates true
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\FirstKey
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Flatten¶
Class Source on GitHub
Flattens an array up to the one level depth, unless $deep is set to
true
Phalcon\Support\Helper\Arr\Flatten
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Get¶
Class Source on GitHub
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
Phalcon\Support\Helper\Arr\Get
Method Summary¶
public
mixed
__invoke(array $collection,mixed $index,mixed $defaultValue = null,string $cast = null)
Methods¶
__invoke()¶
public function __invoke(
array $collection,
mixed $index,
mixed $defaultValue = null,
string $cast = null
): mixed;
Support\Helper\Arr\Group¶
Class Source on GitHub
Groups the elements of an array based on the passed callable
Phalcon\Support\Helper\Arr\Group
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Has¶
Class Source on GitHub
Checks an array if it has an element with a specific key and returns
true/false accordingly
Phalcon\Support\Helper\Arr\Has
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\IsUnique¶
Class Source on GitHub
Checks a flat list for duplicate values. Returns true if duplicate values exist and false if values are all unique.
Phalcon\Support\Helper\Arr\IsUnique
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Last¶
Class Source on GitHub
Returns the last element of the collection. If a callable is passed, the element returned is the first that validates true
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\Last
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\LastKey¶
Class Source on GitHub
Returns the key of the last element of the collection. If a callable is passed, the element returned is the first that validates true
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\LastKey
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Order¶
Class Source on GitHub
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
Phalcon\Support\Helper\Arr\Order
Method Summary¶
Constants¶
int
ORDER_ASC = 1
int
ORDER_DESC = 2
Methods¶
__invoke()¶
public function __invoke(
array $collection,
mixed $attribute,
int $order = self::ORDER_ASC,
int $flags = 0
): array;
Support\Helper\Arr\Pluck¶
Class Source on GitHub
Returns a subset of the collection based on the values of the collection
Phalcon\Support\Helper\Arr\Pluck
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Set¶
Class Source on GitHub
Sets an array element. Using a key is optional
Phalcon\Support\Helper\Arr\Set
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\SliceLeft¶
Class Source on GitHub
Returns a new array with n elements removed from the left.
Phalcon\Support\Helper\Arr\SliceLeft
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\SliceRight¶
Class Source on GitHub
Returns a new array with n elements removed from the right.
Phalcon\Support\Helper\Arr\SliceRight
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Split¶
Class Source on GitHub
Returns a new array with keys of the collection as one element and values as another
Phalcon\Support\Helper\Arr\Split
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\ToObject¶
Class Source on GitHub
Returns the passed array as an object.
Phalcon\Support\Helper\Arr\ToObject
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\ValidateAll¶
Class Source on GitHub
Returns true if the provided function returns true for all elements of
the collection, false otherwise.
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\ValidateAll
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\ValidateAny¶
Class Source on GitHub
Returns true if the provided function returns true for at least one
element of the collection, false otherwise.
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\ValidateAny
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Arr\Whitelist¶
Class Source on GitHub
White list filter by key: obtain elements of an array filtering by the keys obtained from the elements of a whitelist
Phalcon\Support\Helper\Arr\AbstractArrPhalcon\Support\Helper\Arr\Whitelist
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Exception¶
Class Source on GitHub
Exceptions thrown in Phalcon\Support\Helper will use this class
\Exception
Uses Phalcon\Support\Exception
Support\Helper\File\Basename¶
Class Source on GitHub
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.
Phalcon\Support\Helper\File\Basename
Method Summary¶
public
string
__invoke(string $uri,string $suffix = null)
@see https://bugs.php.net/bug.php?id=37738
Methods¶
__invoke()¶
@see https://bugs.php.net/bug.php?id=37738
Support\Helper\Json\Decode¶
Class Source on GitHub
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
If JSON_THROW_ON_ERROR is defined in the options a JsonException will be thrown in the case of an error. Otherwise, any error will throw JsonDecodeError
Phalcon\Support\Helper\Json\Decode
Uses Phalcon\Support\Helper\Json\Exceptions\JsonDecodeError
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $data,
bool $associative = false,
int $depth = 512,
int $options = 79
);
Support\Helper\Json\Encode¶
Class Source on GitHub
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
If JSON_THROW_ON_ERROR is defined in the options a JsonException will be thrown in the case of an error. Otherwise, any error will throw JsonEncodeError
@see https://www.ietf.org/rfc/rfc4627.txt
Phalcon\Support\Helper\Json\Encode
Uses Phalcon\Support\Helper\Json\Exceptions\JsonEncodeError
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Json\Exceptions\JsonDecodeError¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\Support\Helper\Json\Exceptions\JsonDecodeError
Uses InvalidArgumentException · Throwable
Method Summary¶
Methods¶
__construct()¶
Support\Helper\Json\Exceptions\JsonEncodeError¶
Class Source on GitHub
InvalidArgumentExceptionPhalcon\Support\Helper\Json\Exceptions\JsonEncodeError
Uses InvalidArgumentException · Throwable
Method Summary¶
Methods¶
__construct()¶
Support\Helper\Number\IsBetween¶
Class Source on GitHub
Checks if a number is within a range
Phalcon\Support\Helper\Number\IsBetween
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\AbstractStr¶
Abstract Source on GitHub
Abstract class offering methods to help with the Str namespace. This can be moved to a trait once Zephir supports it.
This base exists only for the Str helper hierarchy; it is not a general
base class. New code that needs these routines should compose the relevant
invokable helper (for example Str\Interpolate) rather than extending it.
@internal
@todo move to trait when there is support for it
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Logger\Formatter\AbstractFormatterPhalcon\Support\Helper\Str\ConcatPhalcon\Support\Helper\Str\DecapitalizePhalcon\Support\Helper\Str\EndsWithPhalcon\Support\Helper\Str\FriendlyPhalcon\Support\Helper\Str\IsLowerPhalcon\Support\Helper\Str\IsUpperPhalcon\Support\Helper\Str\LowerPhalcon\Support\Helper\Str\StartsWithPhalcon\Support\Helper\Str\Upper
Method Summary¶
protected
bool
toEndsWith(string $haystack,string $needle,bool $ignoreCase = true)
Check if a string ends with a given string
protected
string
toInterpolate(string $input,array $context = [],string $left = "%",string $right = "%")
Interpolates context values into the message placeholders
protected
string
toLower(string $text,string $encoding = "UTF-8")
Lowercases a string using mbstring
protected
bool
toStartsWith(string $haystack,string $needle,bool $ignoreCase = true)
Check if a string starts with a given string
protected
string
toUpper(string $text,string $encoding = "UTF-8")
Uppercases a string using mbstring
Methods¶
toEndsWith()¶
Check if a string ends with a given string
toInterpolate()¶
protected function toInterpolate(
string $input,
array $context = [],
string $left = "%",
string $right = "%"
): string;
Interpolates context values into the message placeholders
@see https://www.php-fig.org/psr/psr-3/ Section 1.2 Message
toLower()¶
Lowercases a string using mbstring
toStartsWith()¶
Check if a string starts with a given string
toUpper()¶
Uppercases a string using mbstring
Support\Helper\Str\Camelize¶
Class Source on GitHub
Converts strings to upperCamelCase or lowerCamelCase
Phalcon\Support\Helper\Str\PascalCasePhalcon\Support\Helper\Str\Camelize
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $text,
string $delimiters = null,
bool $lowerFirst = false
): string;
Support\Helper\Str\Concat¶
Class Source on GitHub
Concatenates strings using the separator only once without duplication in places concatenation
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\Concat
Uses Phalcon\Support\Helper\Str\Exceptions\InsufficientArguments
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\CountVowels¶
Class Source on GitHub
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.
Phalcon\Support\Helper\Str\CountVowels
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Decapitalize¶
Class Source on GitHub
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.
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\Decapitalize
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $text,
bool $upperRest = false,
string $encoding = "UTF-8"
): string;
Support\Helper\Str\Decrement¶
Class Source on GitHub
Removes a number from the end of a string or decrements that number if it is already defined
Phalcon\Support\Helper\Str\Decrement
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\DirFromFile¶
Class Source on GitHub
Accepts a file name (without extension) and returns a calculated directory structure with the filename in the end
Phalcon\Support\Helper\Str\DirFromFile
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\DirSeparator¶
Class Source on GitHub
Accepts a directory name and ensures that it ends with DIRECTORY_SEPARATOR
Phalcon\Support\Helper\Str\DirSeparator
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Dynamic¶
Class Source on GitHub
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
Phalcon\Support\Helper\Str\Dynamic
Uses Phalcon\Support\Helper\Str\Exceptions\SyntaxError
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $text,
string $leftDelimiter = "{",
string $rightDelimiter = "}",
string $separator = "|"
): string;
Support\Helper\Str\EndsWith¶
Class Source on GitHub
Check if a string ends with a given string
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\EndsWith
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Exceptions\InsufficientArguments¶
Class Source on GitHub
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Helper\ExceptionPhalcon\Support\Helper\Str\Exceptions\InsufficientArguments
Uses Phalcon\Support\Helper\Exception
Method Summary¶
Methods¶
__construct()¶
Support\Helper\Str\Exceptions\InvalidReplaceFormat¶
Class Source on GitHub
\ExceptionPhalcon\Support\ExceptionPhalcon\Support\Helper\ExceptionPhalcon\Support\Helper\Str\Exceptions\InvalidReplaceFormat
Uses Phalcon\Support\Helper\Exception
Support\Helper\Str\Exceptions\SyntaxError¶
Class Source on GitHub
RuntimeExceptionPhalcon\Support\Helper\Str\Exceptions\SyntaxError
Uses RuntimeException
Method Summary¶
Methods¶
__construct()¶
Support\Helper\Str\FirstBetween¶
Class Source on GitHub
Returns the first string there is between the strings from the parameter start and end.
Phalcon\Support\Helper\Str\FirstBetween
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Friendly¶
Class Source on GitHub
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.
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\Friendly
Uses Phalcon\Support\Helper\Str\Exceptions\InvalidReplaceFormat
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $text,
string $separator = "-",
bool $lowercase = true,
mixed $replace = null
): string;
Support\Helper\Str\Humanize¶
Class Source on GitHub
Makes an underscored or dashed text human-readable
Phalcon\Support\Helper\Str\Humanize
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Includes¶
Class Source on GitHub
Determines whether a string includes another string or not.
Phalcon\Support\Helper\Str\Includes
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Increment¶
Class Source on GitHub
Adds a number to the end of a string or increments that number if it is already defined
Phalcon\Support\Helper\Str\Increment
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Interpolate¶
Class Source on GitHub
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
Phalcon\Support\Helper\Str\Interpolate
Method Summary¶
Methods¶
__invoke()¶
public function __invoke(
string $message,
array $context = [],
string $leftToken = "%",
string $rightToken = "%"
): string;
Support\Helper\Str\IsAnagram¶
Class Source on GitHub
Compare two strings and returns true if both strings are anagram,
false otherwise.
Phalcon\Support\Helper\Str\IsAnagram
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\IsLower¶
Class Source on GitHub
Returns true if the given string is in lower case, false otherwise.
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\IsLower
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\IsPalindrome¶
Class Source on GitHub
Returns true if the given string is a palindrome, false otherwise.
Phalcon\Support\Helper\Str\IsPalindrome
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\IsUpper¶
Class Source on GitHub
Returns true if the given string is in upper case, false otherwise.
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\IsUpper
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\KebabCase¶
Class Source on GitHub
Converts strings to kebab-case style
Phalcon\Support\Helper\Str\PascalCasePhalcon\Support\Helper\Str\KebabCase
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Len¶
Class Source on GitHub
Calculates the length of the string using mb_strlen
Phalcon\Support\Helper\Str\Len
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Lower¶
Class Source on GitHub
Converts a string to lowercase using mbstring
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\Lower
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\PascalCase¶
Class Source on GitHub
Converts strings to PascalCase style
Phalcon\Support\Helper\Str\PascalCase
Method Summary¶
public
string
__invoke(string $text,string $delimiters = null)
protected
array
processArray(string $text,string $delimiters = null)
Methods¶
__invoke()¶
processArray()¶
Support\Helper\Str\Prefix¶
Class Source on GitHub
Prefixes the text with the supplied prefix
Phalcon\Support\Helper\Str\Prefix
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Random¶
Class Source on GitHub
Generates a random string based on the given type. Type is one of the RANDOM_* constants
Phalcon\Support\Helper\Str\Random
Method Summary¶
Constants¶
int
RANDOM_ALNUM = 0
Only alphanumeric characters [a-zA-Z0-9]
int
RANDOM_ALPHA = 1
Only alphabetical characters [azAZ]
int
RANDOM_DISTINCT = 5
Only alphanumeric uppercase characters exclude similar
characters [2345679ACDEFHJKLMNPRSTUVWXYZ]
int
RANDOM_HEXDEC = 2
Only hexadecimal characters [0-9a-f]
int
RANDOM_NOZERO = 4
Only numbers without 0 [1-9]
int
RANDOM_NUMERIC = 3
Only numbers [0-9]
Methods¶
__invoke()¶
Support\Helper\Str\ReduceSlashes¶
Class Source on GitHub
Reduces multiple slashes in a string to single slashes
Phalcon\Support\Helper\Str\ReduceSlashes
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\SnakeCase¶
Class Source on GitHub
Converts strings to snake_case style
Phalcon\Support\Helper\Str\PascalCasePhalcon\Support\Helper\Str\SnakeCase
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\StartsWith¶
Class Source on GitHub
Check if a string starts with a given string
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\StartsWith
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Suffix¶
Class Source on GitHub
Suffixes the text with the supplied suffix
Phalcon\Support\Helper\Str\Suffix
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Ucwords¶
Class Source on GitHub
Capitalizes the first letter of each word
Phalcon\Support\Helper\Str\Ucwords
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Uncamelize¶
Class Source on GitHub
Converts strings to non camelized style
Phalcon\Support\Helper\Str\Uncamelize
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Underscore¶
Class Source on GitHub
Makes a text underscored instead of spaced
Phalcon\Support\Helper\Str\Underscore
Method Summary¶
Methods¶
__invoke()¶
Support\Helper\Str\Upper¶
Class Source on GitHub
Converts a string to uppercase using mbstring
Phalcon\Support\Helper\Str\AbstractStrPhalcon\Support\Helper\Str\Upper
Method Summary¶
Methods¶
__invoke()¶
Support\Registry¶
Final Source on GitHub
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.
Phalcon\Support\CollectionPhalcon\Support\Registry
Uses Phalcon\Support\Collection · Traversable
Method Summary¶
public
__construct( array $data = [] )
Constructor
public
mixed
__get( string $element )
Magic getter to get an element from the collection
public
bool
__isset( string $element )
Magic isset to check whether an element exists or not
public
void
__set(string $element,mixed $value)
Magic setter to assign values to an element
public
void
__unset( string $element )
Magic unset to remove an element from the collection
public
void
clear()
Clears the internal collection
public
int
count()
Count elements of an object
public
mixed
get(string $element,mixed $defaultValue = null,string $cast = null)
Get the element from the collection
public
Traversable
getIterator()
Returns the iterator of the class
public
bool
has( string $element )
Determines whether an element is present in the collection.
public
void
init( array $data = [] )
Initialize internal array
public
array
jsonSerialize()
Specify data which should be serialized to JSON
public
bool
offsetExists( mixed $element )
Whether a offset exists
public
mixed
offsetGet( mixed $element )
Offset to retrieve
public
void
offsetSet(mixed $element,mixed $value)
Offset to set
public
void
offsetUnset( mixed $element )
Offset to unset
public
void
remove( string $element )
Delete the element from the collection
public
string|null
serialize()
String representation of object
public
void
set(string $element,mixed $value)
Set an element in the collection
public
array
toArray()
Returns the object in an array format
public
string
toJson( int $options = 79 )
Returns the object in a JSON format
public
void
unserialize( string $data )
Constructs the object
Methods¶
__construct()¶
Constructor
__get()¶
Magic getter to get an element from the collection
__isset()¶
Magic isset to check whether an element exists or not
__set()¶
Magic setter to assign values to an element
__unset()¶
Magic unset to remove an element from the collection
clear()¶
Clears the internal collection
count()¶
Count elements of an object
@link https://php.net/manual/en/countable.count.php
get()¶
final public function get(
string $element,
mixed $defaultValue = null,
string $cast = null
): mixed;
Get the element from the collection
getIterator()¶
Returns the iterator of the class
has()¶
Determines whether an element is present in the collection.
init()¶
Initialize internal array
jsonSerialize()¶
Specify data which should be serialized to JSON
@link https://php.net/manual/en/jsonserializable.jsonserialize.php
offsetExists()¶
Whether a offset exists
@link https://php.net/manual/en/arrayaccess.offsetexists.php
offsetGet()¶
Offset to retrieve
@link https://php.net/manual/en/arrayaccess.offsetget.php
offsetSet()¶
Offset to set
@link https://php.net/manual/en/arrayaccess.offsetset.php
offsetUnset()¶
Offset to unset
@link https://php.net/manual/en/arrayaccess.offsetunset.php
remove()¶
Delete the element from the collection
serialize()¶
String representation of object
@link https://php.net/manual/en/serializable.serialize.php
set()¶
Set an element in the collection
toArray()¶
Returns the object in an array format
toJson()¶
Returns the object in a JSON format
The 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
unserialize()¶
Constructs the object
@link https://php.net/manual/en/serializable.unserialize.php
Support\Settings¶
Class Source on GitHub
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.
Phalcon\Support\Settings
Method Summary¶
public
mixed
get( string $key )
Returns the value of a known setting.
public
void
reset()
Clears all PHP-level overrides, restoring get() to return globals_get()
public
void
set(string $key,mixed $value)
Overrides a setting at the PHP level.
Properties¶
protected
array
$overrides
PHP-level overrides. Keys stored here take priority over globals_get().
Methods¶
get()¶
Returns the value of a known setting.
Resolution order: 1. PHP-level override (set via Settings::set()) 2. globals_get() - the C-level value, honoring php.ini / .htaccess 3. null - for unknown keys
reset()¶
Clears all PHP-level overrides, restoring get() to return globals_get() fallback values (as configured in php.ini or .htaccess).
set()¶
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¶
Class Source on GitHub
This class allows to get the installed version of the framework
Phalcon\Support\Version
Method Summary¶
public
string
get()
Returns the active version (string)
public
string
getId()
Returns the numeric active version
public
string
getPart( int $part )
Returns a specific part of the version. If the wrong parameter is passed
protected
string
getSpecial( int $special )
Translates a number to a special release.
protected
array
getVersion()
Area where the version number is set. The format is as follows:
Constants¶
int
VERSION_MAJOR = 0
The constant referencing the major version. Returns 0
``php
echo (new Phalcon\Support\Version())
->getPart(Phalcon\Support\Version::VERSION_MAJOR);
``
int
VERSION_MEDIUM = 1
The constant referencing the major version. Returns 1
``php
echo (new Phalcon\Support\Version())
->getPart(Phalcon\Support\Version::VERSION_MEDIUM);
``
int
VERSION_MINOR = 2
The constant referencing the major version. Returns 2
``php
echo (new Phalcon\Support\Version())
->getPart(Phalcon\Support\Version::VERSION_MINOR);
``
int
VERSION_SPECIAL = 3
The constant referencing the major version. Returns 3
``php
echo (new Phalcon\Support\Version())
->getPart(Phalcon\Support\Version::VERSION_SPECIAL);
``
int
VERSION_SPECIAL_NUMBER = 4
The constant referencing the major version. Returns 4
``php
echo (new Phalcon\Support\Version())
->getPart(Phalcon\Support\Version::VERSION_SPECIAL_NUMBER);
``
Methods¶
get()¶
Returns the active version (string)
getId()¶
Returns the numeric active version
getPart()¶
Returns a specific part of the version. If the wrong parameter is passed it will return the full version
getSpecial()¶
Translates a number to a special release.
getVersion()¶
Area where the version number is set. The format is as follows: ABBCCDE
A - 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.