Phalcon traits
NOTE
All classes are prefixed with Phalcon
Traits\Factory\ConfigTrait¶
Trait Source on GitHub
Phalcon\Traits\Factory\ConfigTrait
Uses Phalcon\Config\ConfigInterface
Used by Phalcon\Auth\ManagerFactory
Method Summary¶
protected
array
checkConfig( mixed $config )
protected
array
checkConfigElement(array $config,string $element)
Checks if the config has a specific element
Methods¶
checkConfig()¶
checkConfigElement()¶
Checks if the config has a specific element
Traits\Factory\FactoryTrait¶
Trait Source on GitHub
Methods allowing a mapper based factory to operate. Supports injected services, getting a service by name (key), initialization and setting of the exception class (when exceptions are needed to be thrown)
Phalcon\Traits\Factory\FactoryTrait
Uses Exception
Method Summary¶
protected
object
getCachedInstance(string $name,mixed $arguments)
Return an object from the instances pool. If it does not exist, create it
protected
string
getExceptionClass()
Returns the exception class for the factory
protected
string
getService( string $name )
Returns a service based on the name; throws exception if it does not
protected
array
getServices()
Returns the services for the factory
protected
void
init( array $services = [] )
Initializes services
Methods¶
getCachedInstance()¶
Return an object from the instances pool. If it does not exist, create it
getExceptionClass()¶
Returns the exception class for the factory
getService()¶
Returns a service based on the name; throws exception if it does not exist
getServices()¶
Returns the services for the factory
init()¶
Initializes services
Traits\Php\ApcuTrait¶
Trait Source on GitHub
APCu based wrapper methods
Phalcon\Traits\Php\ApcuTrait
Used by Phalcon\Storage\Adapter\Apcu
Method Summary¶
protected
bool|int
phpApcuDec(mixed $key,int $step = 1)
@link https://php.net/manual/en/function.apcu-dec.php
protected
bool|array
phpApcuDelete( mixed $key )
@link https://php.net/manual/en/function.apcu-delete.php
protected
bool|array
phpApcuExists( mixed $key )
@link https://php.net/manual/en/function.apcu-exists.php
protected
mixed
phpApcuFetch( mixed $key )
@link https://php.net/manual/en/function.apcu-fetch.php
protected
bool|int
phpApcuInc(mixed $key,int $step = 1)
@link https://php.net/manual/en/function.apcu-inc.php
protected
\APCUIterator|bool
phpApcuIterator( string $pattern )
@link https://php.net/manual/en/class.apcuiterator.php
protected
bool|array
phpApcuStore(mixed $key,mixed $payload,int $ttl = 0)
@link https://php.net/manual/en/function.apcu-store.php
Methods¶
phpApcuDec()¶
@link https://php.net/manual/en/function.apcu-dec.php
phpApcuDelete()¶
@link https://php.net/manual/en/function.apcu-delete.php
phpApcuExists()¶
@link https://php.net/manual/en/function.apcu-exists.php
phpApcuFetch()¶
@link https://php.net/manual/en/function.apcu-fetch.php
phpApcuInc()¶
@link https://php.net/manual/en/function.apcu-inc.php
phpApcuIterator()¶
@link https://php.net/manual/en/class.apcuiterator.php
phpApcuStore()¶
@link https://php.net/manual/en/function.apcu-store.php
Traits\Php\Base64Trait¶
Trait Source on GitHub
Base64 based wrapper methods
Phalcon\Traits\Php\Base64Trait
Used by Phalcon\Encryption\Crypt · Phalcon\Encryption\Security\JWT\Builder · Phalcon\Encryption\Security\JWT\Token\Parser · Phalcon\Storage\Serializer\Base64
Method Summary¶
protected
string
doDecodeUrl( string $input )
Decode a Base64 URL string
protected
string
doEncodeUrl( string $input )
Encode a string in Base64 URL format
protected
string|false
phpBase64Decode(string $input,bool $strict = false)
@link https://php.net/manual/en/function.base64-decode.php
protected
string
phpBase64Encode( string $input )
@link https://php.net/manual/en/function.base64-encode.php
Methods¶
doDecodeUrl()¶
Decode a Base64 URL string
doEncodeUrl()¶
Encode a string in Base64 URL format
phpBase64Decode()¶
@link https://php.net/manual/en/function.base64-decode.php
phpBase64Encode()¶
@link https://php.net/manual/en/function.base64-encode.php
Traits\Php\FileTrait¶
Trait Source on GitHub
File based wrapper methods
Phalcon\Traits\Php\FileTrait
Used by Phalcon\Annotations\Adapter\Stream · Phalcon\Assets\Asset · Phalcon\Assets\Collection · Phalcon\Assets\Manager · Phalcon\Auth\Adapter\Stream · Phalcon\Cli\Console · Phalcon\Config\Adapter\Json · Phalcon\Encryption\Security\Uuid\SysNodeProvider · Phalcon\Forms\Loader\JsonLoader · Phalcon\Http\Request · Phalcon\Image\Adapter\Gd · Phalcon\Image\Adapter\Imagick · Phalcon\Logger\Adapter\Stream · Phalcon\Mvc\Application · Phalcon\Mvc\Model\MetaData\Stream · Phalcon\Mvc\Router · Phalcon\Mvc\View · Phalcon\Mvc\View\Engine\Volt\Compiler · Phalcon\Mvc\View\Simple · Phalcon\Queue\Adapter\Beanstalk\BeanstalkConnection · Phalcon\Queue\Adapter\Stream\StreamContext · Phalcon\Session\Adapter\Stream · Phalcon\Storage\Adapter\Stream · Phalcon\Translate\Adapter\Csv
Method Summary¶
protected
bool
phpFclose( mixed $handle )
Closes an open file pointer
protected
array|false
phpFgetCsv(mixed $stream,int $length = 0,string $separator = ",",mixed $enclosure = null,mixed $escape = null)
Gets line from file pointer and parse for CSV fields
protected
bool
phpFileExists( string $filename )
@link https://php.net/manual/en/function.file-exists.php
protected
false|string
phpFileGetContents(string $filename,bool $useIncludePath = false,mixed $context = null,int $offset = 0,int|null $length = null)
@link https://php.net/manual/en/function.file-get-contents.php
protected
false|int
phpFilePutContents(string $filename,mixed $data,int $flags = 0,mixed $context = null)
@link https://php.net/manual/en/function.file-put-contents.php
protected
mixed
phpFopen(string $filename,string $mode,bool $useIncludePath = false,mixed $context = null)
@link https://php.net/manual/en/function.fopen.php
protected
false|int
phpFwrite(mixed $handle,string $data,int|null $length = null)
Binary-safe file write
protected
bool
phpIsWritable( string $filename )
Tells whether the filename is writable
protected
bool
phpUnlink(string $filename,mixed $context = null)
@link https://php.net/manual/en/function.unlink.php
Methods¶
phpFclose()¶
Closes an open file pointer
@link https://php.net/manual/en/function.fclose.php
phpFgetCsv()¶
protected static function phpFgetCsv(
mixed $stream,
int $length = 0,
string $separator = ",",
mixed $enclosure = null,
mixed $escape = null
): array|false;
Gets line from file pointer and parse for CSV fields
@link https://php.net/manual/en/function.fgetcsv.php
phpFileExists()¶
@link https://php.net/manual/en/function.file-exists.php
phpFileGetContents()¶
protected static function phpFileGetContents(
string $filename,
bool $useIncludePath = false,
mixed $context = null,
int $offset = 0,
int|null $length = null
): false|string;
@link https://php.net/manual/en/function.file-get-contents.php
phpFilePutContents()¶
protected static function phpFilePutContents(
string $filename,
mixed $data,
int $flags = 0,
mixed $context = null
): false|int;
@link https://php.net/manual/en/function.file-put-contents.php
phpFopen()¶
protected static function phpFopen(
string $filename,
string $mode,
bool $useIncludePath = false,
mixed $context = null
): mixed;
@link https://php.net/manual/en/function.fopen.php
phpFwrite()¶
protected static function phpFwrite(
mixed $handle,
string $data,
int|null $length = null
): false|int;
Binary-safe file write
@link https://php.net/manual/en/function.fwrite.php
phpIsWritable()¶
Tells whether the filename is writable
@link https://php.net/manual/en/function.is-writable.php
phpUnlink()¶
@link https://php.net/manual/en/function.unlink.php
Traits\Php\HashTrait¶
Trait Source on GitHub
Hashing method wrappers
Phalcon\Traits\Php\HashTrait
Used by Phalcon\Assets\Asset · Phalcon\Assets\Inline · Phalcon\Encryption\Crypt · Phalcon\Encryption\Security · Phalcon\Encryption\Security\JWT\Signer\Hmac
Method Summary¶
protected
string
phpHash(string $algorithm,string $data,bool $binary = false)
@link https://php.net/manual/en/function.hash.php
protected
bool
phpHashEquals(string $knownString,string $userString)
@link https://php.net/manual/en/function.hash-equals.php
protected
string
phpHashHmac(string $algorithm,string $data,string $key,bool $binary = false)
@link https://php.net/manual/en/function.hash-hmac.php
Methods¶
phpHash()¶
@link https://php.net/manual/en/function.hash.php
phpHashEquals()¶
@link https://php.net/manual/en/function.hash-equals.php
phpHashHmac()¶
protected static function phpHashHmac(
string $algorithm,
string $data,
string $key,
bool $binary = false
): string;
@link https://php.net/manual/en/function.hash-hmac.php
Traits\Php\HeaderTrait¶
Trait Source on GitHub
Header based wrapper methods
Phalcon\Traits\Php\HeaderTrait
Used by Phalcon\Session\Manager
Method Summary¶
Methods¶
phpHeadersSent()¶
Checks if or where headers have been sent
@link https://php.net/manual/en/function.headers-sent.php
Traits\Php\IgbinaryTrait¶
Trait Source on GitHub
Igbinary based wrapper methods
Phalcon\Traits\Php\IgbinaryTrait
Used by Phalcon\Storage\Serializer\Igbinary
Method Summary¶
protected
string|null
phpIgbinarySerialize( mixed $value )
@link https://php.net/manual/en/function.igbinary-serialize.php
protected
phpIgbinaryUnserialize( mixed $value )
@link https://php.net/manual/en/function.igbinary-unserialize.php
Methods¶
phpIgbinarySerialize()¶
@link https://php.net/manual/en/function.igbinary-serialize.php
phpIgbinaryUnserialize()¶
@link https://php.net/manual/en/function.igbinary-unserialize.php
Traits\Php\InfoTrait¶
Trait Source on GitHub
Information method wrappers
Phalcon\Traits\Php\InfoTrait
Used by Phalcon\Config\Adapter\Yaml · Phalcon\Encryption\Crypt · Phalcon\Encryption\Security\Uuid\SysNodeProvider · Phalcon\Filter\Validation\Validator\Confirmation · Phalcon\Filter\Validation\Validator\File\MimeType · Phalcon\Filter\Validation\Validator\StringLength\Max · Phalcon\Filter\Validation\Validator\StringLength\Min · Phalcon\Forms\Loader\YamlLoader · Phalcon\Http\Response · Phalcon\Image\Adapter\Gd · Phalcon\Mvc\View\Engine\Volt · Phalcon\Queue\Consumer\Worker · Phalcon\Support\Debug\ReportBuilder · Phalcon\Support\Helper\Arr\Group · Phalcon\Translate\Adapter\Gettext
Method Summary¶
protected
bool
phpExtensionLoaded( string $name )
Find out whether an extension is loaded
protected
bool
phpFunctionExists( string $functionName )
Return true if the given function has been defined
Methods¶
phpExtensionLoaded()¶
Find out whether an extension is loaded
@link https://php.net/manual/en/function.extension-loaded.php
phpFunctionExists()¶
Return true if the given function has been defined
@link https://php.net/manual/en/function.function-exists.php
Traits\Php\IniTrait¶
Trait Source on GitHub
Phalcon\Traits\Php\IniTrait
Used by Phalcon\Config\Adapter\Ini · Phalcon\Session\Adapter\Stream
Method Summary¶
protected
string
phpIniGet(string $input,string $defaultValue = "")
Gets the value of a configuration option
protected
bool
phpIniGetBool(string $input,bool $defaultValue = false)
Query a php.ini value and return it back as boolean
protected
int
phpIniGetInt(string $input,int $defaultValue = 0)
Query a php.ini value and return it back as integer
protected
array|false
phpParseIniFile(string $filename,bool $processSections = false,int $scannerMode = 0)
Parse a configuration file
Methods¶
phpIniGet()¶
Gets the value of a configuration option
@link https://php.net/manual/en/function.ini-get.php @link https://php.net/manual/en/ini.list.php
phpIniGetBool()¶
Query a php.ini value and return it back as boolean
@link https://php.net/manual/en/function.ini-get.php @link https://php.net/manual/en/ini.list.php
phpIniGetInt()¶
Query a php.ini value and return it back as integer
@link https://php.net/manual/en/function.ini-get.php @link https://php.net/manual/en/ini.list.php
phpParseIniFile()¶
protected static function phpParseIniFile(
string $filename,
bool $processSections = false,
int $scannerMode = 0
): array|false;
Parse a configuration file
@link https://php.net/manual/en/function.parse-ini-file.php
Traits\Php\MbCaseTrait¶
Trait Source on GitHub
Multibyte case conversion wrapper method
Phalcon\Traits\Php\MbCaseTrait
Used by Phalcon\Filter\Sanitize\Lower · Phalcon\Filter\Sanitize\Upper · Phalcon\Filter\Sanitize\UpperWords
Method Summary¶
Methods¶
phpMbConvertCase()¶
Converts the case of a string using mb_convert_case()
@link https://php.net/manual/en/function.mb-convert-case.php
Traits\Php\MsgpackTrait¶
Trait Source on GitHub
MessagePack based wrapper methods
Phalcon\Traits\Php\MsgpackTrait
Used by Phalcon\Storage\Serializer\Msgpack
Method Summary¶
protected
string
phpMsgpackPack( mixed $value )
@link https://php.net/manual/en/function.msgpack-pack.php
protected
phpMsgpackUnpack( mixed $value )
@link https://php.net/manual/en/function.msgpack-unpack.php
Methods¶
phpMsgpackPack()¶
@link https://php.net/manual/en/function.msgpack-pack.php
phpMsgpackUnpack()¶
@link https://php.net/manual/en/function.msgpack-unpack.php
Traits\Php\OpensslTrait¶
Trait Source on GitHub
OpenSSL based wrapper methods
Phalcon\Traits\Php\OpensslTrait
Used by Phalcon\Encryption\Crypt
Method Summary¶
protected
int|bool
phpOpensslCipherIvLength( string $cipher )
@link https://php.net/manual/en/function.openssl-cipher-iv-length.php
protected
phpOpensslRandomPseudoBytes( int $length )
@link https://php.net/manual/en/function.openssl-random-pseudo-bytes.php
Methods¶
phpOpensslCipherIvLength()¶
@link https://php.net/manual/en/function.openssl-cipher-iv-length.php
phpOpensslRandomPseudoBytes()¶
@link https://php.net/manual/en/function.openssl-random-pseudo-bytes.php
Traits\Php\SerializeTrait¶
Trait Source on GitHub
PHP serialize/unserialize wrapper methods
Phalcon\Traits\Php\SerializeTrait
Used by Phalcon\Storage\Serializer\Php
Method Summary¶
protected
string
phpSerialize( mixed $value )
@link https://php.net/manual/en/function.serialize.php
protected
mixed
phpUnserialize(string $data,array $options = [])
@link https://php.net/manual/en/function.unserialize.php
Methods¶
phpSerialize()¶
@link https://php.net/manual/en/function.serialize.php
phpUnserialize()¶
@link https://php.net/manual/en/function.unserialize.php
Traits\Php\UrlTrait¶
Trait Source on GitHub
URL based wrapper methods
Phalcon\Traits\Php\UrlTrait
Used by Phalcon\Html\Escaper\UrlEscaper · Phalcon\Http\Response
Method Summary¶
protected
phpParseUrl(string $url,int $component = -1)
@link https://php.net/manual/en/function.parse-url.php
protected
string
phpRawUrlDecode( string $input )
@link https://php.net/manual/en/function.rawurldecode.php
protected
string
phpRawUrlEncode( string $input )
@link https://php.net/manual/en/function.rawurlencode.php
Methods¶
phpParseUrl()¶
@link https://php.net/manual/en/function.parse-url.php
phpRawUrlDecode()¶
@link https://php.net/manual/en/function.rawurldecode.php
phpRawUrlEncode()¶
@link https://php.net/manual/en/function.rawurlencode.php
Traits\Php\YamlTrait¶
Trait Source on GitHub
YAML based wrapper methods
Phalcon\Traits\Php\YamlTrait
Used by Phalcon\Config\Adapter\Yaml
Method Summary¶
Methods¶
phpYamlParseFile()¶
protected static function phpYamlParseFile(
string $filename,
int $pos = 0,
array $callbacks = []
);
Parse a YAML stream from a file
@link https://php.net/manual/en/function.yaml-parse-file.php
Traits\Support\Helper\Arr\FilterTrait¶
Trait Source on GitHub
Filters a collection using array_filter with an optional callable
Phalcon\Traits\Support\Helper\Arr\FilterTrait
Used by Phalcon\Support\Helper\Arr\AbstractArr
Method Summary¶
Methods¶
toFilter()¶
Helper method to filter the collection
Traits\Support\Helper\Arr\GetTrait¶
Trait 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\Traits\Support\Helper\Arr\GetTrait
Used by Phalcon\ADR\Middleware\CorsMiddleware · Phalcon\Annotations\AnnotationsFactory · Phalcon\Db\Adapter\PdoFactory · Phalcon\Filter\Validation\Validator\File · Phalcon\Http\Cookie · Phalcon\Http\Request\File · Phalcon\Image\ImageFactory · Phalcon\Logger\LoggerFactory · Phalcon\Mvc\Model\MetaData · Phalcon\Session\Adapter\AbstractAdapter · Phalcon\Session\Adapter\Stream · Phalcon\Session\Manager · Phalcon\Storage\Adapter\AbstractAdapter · Phalcon\Support\Debug · Phalcon\Support\Debug\ReportBuilder · Phalcon\Support\Helper\Arr\Get
Method Summary¶
Methods¶
getArrVal()¶
protected static function getArrVal(
array $collection,
mixed $index,
mixed $defaultValue = null,
string|null $cast = null
): mixed;
Traits\Support\Helper\Json\DecodeTrait¶
Trait Source on GitHub
Decodes a string using json_decode, throwing the native \JsonException
on failure. Any framework-flavored exception is added by the Support
helper class that wraps this trait.
Phalcon\Traits\Support\Helper\Json\DecodeTrait
Used by Phalcon\Support\Helper\Json\Decode
Method Summary¶
Methods¶
toDecode()¶
protected static function toDecode(
string $data,
bool $associative = false,
int $depth = 512,
int $options = 79
);
Decodes a string using json_decode
Traits\Support\Helper\Json\EncodeTrait¶
Trait Source on GitHub
Encodes data using json_encode, throwing the native \JsonException on
failure. Any framework-flavored exception is added by the Support helper
class that wraps this trait.
Phalcon\Traits\Support\Helper\Json\EncodeTrait
Used by Phalcon\Logger\Formatter\Json · Phalcon\Support\Helper\Json\Encode
Method Summary¶
Methods¶
toEncode()¶
Encodes data using json_encode
Traits\Support\Helper\Str\CamelizeTrait¶
Trait Source on GitHub
Converts strings to upperCamelCase or lowerCamelCase
Phalcon\Traits\Support\Helper\Str\CamelizeTrait
Used by Phalcon\Support\Helper\Str\Camelize
Method Summary¶
Methods¶
toCamelize()¶
public static function toCamelize(
string $text,
string $delimiters = "-_",
bool $lowerFirst = false
): string;
Traits\Support\Helper\Str\DirFromFileTrait¶
Trait Source on GitHub
Accepts a file name (without extension) and returns a calculated directory structure with the filename in the end
Phalcon\Traits\Support\Helper\Str\DirFromFileTrait
Used by Phalcon\Storage\Adapter\Stream · Phalcon\Support\Helper\Str\DirFromFile
Method Summary¶
Methods¶
toDirFromFile()¶
Traits\Support\Helper\Str\DirSeparatorTrait¶
Trait Source on GitHub
Accepts a directory name and ensures that it ends with DIRECTORY_SEPARATOR
Phalcon\Traits\Support\Helper\Str\DirSeparatorTrait
Used by Phalcon\Mvc\View · Phalcon\Mvc\View\Simple · Phalcon\Session\Adapter\Stream · Phalcon\Storage\Adapter\Stream · Phalcon\Support\Helper\Str\DirSeparator
Method Summary¶
Methods¶
toDirSeparator()¶
Traits\Support\Helper\Str\EndsWithTrait¶
Trait Source on GitHub
Check if a string ends with a given string
Phalcon\Traits\Support\Helper\Str\EndsWithTrait
Used by Phalcon\Support\Helper\Str\AbstractStr
Method Summary¶
Methods¶
toEndsWith()¶
protected static function toEndsWith(
string $haystack,
string $needle,
bool $ignoreCase = true
): bool;
Traits\Support\Helper\Str\InterpolateTrait¶
Trait Source on GitHub
Interpolates context values into the message placeholders
@see http://www.php-fig.org/psr/psr-3/ Section 1.2 Message
Phalcon\Traits\Support\Helper\Str\InterpolateTrait
Used by Phalcon\Logger\Formatter\AbstractFormatter · Phalcon\Support\Debug\Dump · Phalcon\Support\Debug\Renderer\HtmlRenderer · Phalcon\Support\Helper\Str\AbstractStr · Phalcon\Support\Helper\Str\Interpolate · Phalcon\Translate\Interpolator\AssociativeArray
Method Summary¶
Methods¶
toInterpolate()¶
protected static function toInterpolate(
string $input,
array $context = [],
string $left = "%",
string $right = "%"
): string;
Traits\Support\Helper\Str\LowerTrait¶
Trait Source on GitHub
Lowercases a string using mbstring
Phalcon\Traits\Support\Helper\Str\LowerTrait
Used by Phalcon\Support\Helper\Str\AbstractStr
Method Summary¶
Methods¶
toLower()¶
Traits\Support\Helper\Str\StartsWithTrait¶
Trait Source on GitHub
Check if a string starts with a given string
Phalcon\Traits\Support\Helper\Str\StartsWithTrait
Used by Phalcon\Support\Helper\Str\AbstractStr
Method Summary¶
Methods¶
toStartsWith()¶
protected static function toStartsWith(
string $haystack,
string $needle,
bool $ignoreCase = true
): bool;
Traits\Support\Helper\Str\UncamelizeTrait¶
Trait Source on GitHub
Converts strings to non camelized style
Phalcon\Traits\Support\Helper\Str\UncamelizeTrait
Used by Phalcon\Support\Helper\Str\Uncamelize
Method Summary¶
Methods¶
toUncamelize()¶
Traits\Support\Helper\Str\UpperTrait¶
Trait Source on GitHub
Uppercases a string using mbstring
Phalcon\Traits\Support\Helper\Str\UpperTrait
Used by Phalcon\Support\Helper\Str\AbstractStr