Orpheus

API Documentation

Table of Contents

Namespaces

Orpheus

Constants

ACCESS_PATH  = __DIR__ . '/../public'
ADMIN_EMAIL  = 'ADMIN_EMAIL_IS_MISSING'
ADMIN_EMAIL  = 'admin@domain.com'
APPLICATION_PATH  = \ORPHEUS_PATH
AUTHOR_NAME  = 'AUTHOR_IS_MISSING'
AUTHOR_NAME  = 'Developer'
AUTHOR_WEBSITE  = 'https://developer.com/'
CACHE_PATH  = \STORE_PATH . '/cache'
CHECK_MODULE_ACCESS  = \true
COMPOSER_HOME  = \INSTANCE_PATH . '/.composer'
CONFIG_FOLDER  = '/config'
CRAC_CONTEXT_AGENCY  = 2
CRAC_CONTEXT_APPLICATION  = 1
CRAC_CONTEXT_RESOURCE  = 3
DATE_FORMAT_GNU  = 1
DATE_FORMAT_LOCALE  = 0
DEBUG_ENABLED  = \true
DEFAULT_HOST  = 'APP_DOMAIN_IS_MISSING'
DEFAULT_HOST  = 'domain.com'
DEFAULT_LOCALE  = 'en_US'
DEFAULT_LOCALE  = $envConfig['LOCALE']
DEFAULT_MEMBER_ROUTE  = \ROUTE_HOME
DEFAULT_MEMBER_ROUTE  = \DEFAULT_ROUTE
DEFAULT_PACKAGES  = ['@application']
DEFAULT_PATH  = '/'
DEFAULT_ROUTE  = \ROUTE_HOME
DEFAULT_ROUTE  = 'home'
DEV_EMAIL  = 'DEV_EMAIL_IS_MISSING'
DEV_EMAIL  = 'developer@domain.com'
DEV_VERSION  = \true
DOMAIN_APP  = 'application'
DOMAIN_CACHE  = 'cache'
DOMAIN_COMPOSER  = 'composer'
DOMAIN_LOGS  = 'logs'
DOMAIN_SETUP  = 'setup'
DOMAIN_SETUP  = 'setup'
DOMAIN_TEST  = 'test'
DOMAIN_TRANSLATIONS  = 'translations'
DOMAIN_TRANSLATIONS  = 'translations'
DOMAIN_USER  = 'user'
EMAIL_SENDER_NAME  = 'Application name'
ENTITY_CLASS_CHECK  = \true
ENTITY_DESCRIPTOR_CONFIG_FOLDER  = '/entities'
ERROR_DEBUG_LEVEL  = \E_ALL
ERROR_DISPLAY_RAW  = 1
ERROR_IGNORE  = 2
ERROR_PROD_LEVEL  = \E_CORE_ERROR
ERROR_THROW_EXCEPTION  = 0
FACEBOOK_APP_ID  = ''
FACEBOOK_APP_SECRET  = ''
FILE_SOURCE_TYPE_DATA_URI  = 'datauri'
FILE_SOURCE_TYPE_UPLOAD  = 'upload'
FILE_SOURCE_TYPE_UPLOAD_CONVERTED  = 'upload_converted'
FILE_SOURCE_TYPE_WKPDF  = 'wkpdf'
FILE_STORE_PATH  = \STORE_PATH . '/files'
FILE_USAGE_INVOICE  = 'invoice'
FILE_USAGE_USER_PICTURE  = 'user_picture'
HOST  = \SCHEME
HTTP_BAD_REQUEST  = 400
HTTP_FORBIDDEN  = 403
HTTP_FOUND  = 302
HTTP_INTERNAL_SERVER_ERROR  = 500
HTTP_METHOD_GET  = 'GET'
HTTP_MOVED_PERMANENTLY  = 301
HTTP_MOVED_TEMPORARILY  = \HTTP_FOUND
HTTP_NOT_FOUND  = 404
HTTP_OK  = 200
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
HTTP_UNAUTHORIZED  = 401
HTTPS  = \true
IMAGES_URL  = \STATIC_ASSETS_URL . '/images'
INSTANCE_ID  = 'orpheus.local'
INSTANCE_PATH  = \APPLICATION_PATH
IS_CONSOLE  = \PHP_SAPI === 'cli'
IS_WEB  = !\IS_CONSOLE
JS_URL  = \STATIC_ASSETS_URL . '/js'
LANG_FOLDER  = '/languages'
LOGFILE_DEBUG  = 'debug.log'
LOGFILE_HACK  = 'hack.log'
LOGFILE_NOT_FOUND  = 'not-found.log'
LOGFILE_SQL  = 'sql.log'
LOGFILE_SYSTEM  = 'system.log'
LOGS_PATH  = \STORE_PATH . '/logs'
OPT_ENTITY  = 4
OPT_KEY  = \OPT_VALUE_IS_KEY | \OPT_LABEL_IS_KEY
OPT_LABEL2VALUE  = \OPT_VALUE_IS_VALUE | \OPT_LABEL_IS_KEY
OPT_LABEL_IS_KEY  = 2
OPT_LABEL_IS_VALUE  = 0
OPT_VALUE  = \OPT_VALUE_IS_VALUE | \OPT_LABEL_IS_VALUE
OPT_VALUE2LABEL  = \OPT_VALUE_IS_KEY | \OPT_LABEL_IS_VALUE
OPT_VALUE_IS_KEY  = 1
OPT_VALUE_IS_VALUE  = 0
ORPHEUS_PATH  = '..'
PATH  = '/'
REPLY_EMAIL  = 'no-reply@domain.com'
ROUTE_ADM_HOME  = 'admin_home'
ROUTE_ADM_MY_SETTINGS  = 'adm_my_settings'
ROUTE_ADM_USER  = 'adm_user'
ROUTE_ADM_USER_LIST  = 'adm_user_list'
ROUTE_DEV_APP_TRANSLATE  = 'dev_translate'
ROUTE_DEV_COMPOSER  = 'dev_composer'
ROUTE_DEV_CONFIG  = 'dev_config'
ROUTE_DEV_ENTITIES  = 'dev_entities'
ROUTE_DEV_HOME  = 'dev_home'
ROUTE_DEV_LOG_VIEW  = 'dev_log_view'
ROUTE_DEV_LOGS  = 'dev_logs'
ROUTE_DEV_SYSTEM  = 'dev_system'
ROUTE_DOWNLOAD_LATEST  = 'download_latest'
ROUTE_DOWNLOAD_RELEASES  = 'download_releases'
ROUTE_FILE_DOWNLOAD  = 'file_download'
ROUTE_HOME  = 'home'
ROUTE_USER_LOGIN  = 'login'
ROUTE_USER_LOGOUT  = 'logout'
SCHEME  = 'https'
SESSION_COOKIE_LIFETIME  = 86400 * 7
SESSION_COOKIE_PATH  = '/'
SESSION_SHARE_ACROSS_SUBDOMAIN  = \false
SESSION_WITH_COOKIE  = 1 << 0
SESSION_WITH_HTTP_TOKEN  = 1 << 1
SRC_PATH  = \APPLICATION_PATH . '/src'
STATIC_ASSETS_URL  = \WEB_ROOT . '/static'
STORE_PATH  = \INSTANCE_PATH . '/store'
STYLE_URL  = \STATIC_ASSETS_URL . '/style'
SYSTEM_TIME_FORMAT  = 'H:M'
TEMP_PATH  = \STORE_PATH . '/temp'
THEMES_FOLDER  = '/themes'
THEMES_PATH  = \ACCESS_PATH . \THEMES_FOLDER
THEMES_PATH  = \ACCESS_PATH . \THEMES_FOLDER
TIME  = 1000000
TRANSLATIONS_PATH  = \STORE_PATH . '/translations'
VENDOR_PATH  = \INSTANCE_PATH . '/vendor'
VENDOR_URL  = \STATIC_ASSETS_URL . '/vendor'
WEB_ROOT  = \SCHEME . '://' . \HOST . (\PATH !== '/' ? \PATH : '')

Functions

displayByteRow()  : void
displayRow()  : void
rowStaticInput()  : void
collapsiblePanelHTML()  : void
listFileUsages()  : array<string|int, mixed>
listFileSourceTypes()  : array<string|int, mixed>
run()  : void
writeError()  : void
writeText()  : void
writeInfo()  : void
writeSuccess()  : void
parseYesNoValue()  : bool
getComposerRevisions()  : array<string|int, mixed>
sendAdminRegistrationEmail()  : void
storeBackTrace()  : void
defifn()  : true
Define an undefined constant.
safeConstant()  : mixed|null
Get the nullable value of the constant
getParentPath()  : string
Gets the directory path
pathOf()  : string|null
Gets the path of a file/directory.
existsPathOf()  : bool
Checks if the path exists.
addSrcPath()  : bool
Add the path to the known paths
listSrcPath()  : array<string|int, string>
List all source paths
includeFolder()  : int
Include a directory
escapeText()  : string
Escape the text $str from special characters
http_response_code_text()  : mixed
displayException()  : never
displayExceptionAsHTML()  : never
displayExceptionAsText()  : never
typeOf()  : string
displayRawException()  : void
displayStackTraceAsHtml()  : void
displayExceptionStackTrace()  : void
getClassName()  : string
processException()  : void
getErrorException()  : ErrorException
convertExceptionAsHTMLPage()  : string
convertExceptionAsText()  : string
formatSourceAsText()  : string
getFileLines()  : array<string|int, mixed>|string
str_limit()  : string
Limits the length of a string and append $end.
matchBits()  : bool
Do a binary test to check $value is matching $reference
scanFolder()  : array<string|int, string>
Scans a directory cleanly.
stringify()  : string
Stringify any variable
toHtml()  : string
Convert a variable to an HTML-readable string
toString()  : string
Convert a variable a Text-readable string
formatException()  : string
Format the input Exception to a human-readable string
getDebugTrace()  : array<string|int, mixed>
Get the debug trace filtered by $filterStartWith
log_report()  : void
Log a report in a file.
log_debug()  : void
Log a debug
log_hack()  : void
Log a hack attempt The log file is the constant LOGFILE_HACK or, if undefined, '.hack'.
log_error()  : void
Log a system error The log file is the constant LOGFILE_SYSTEM or, if undefined, '.log_error'.
sql_error()  : void
Log a sql error The log file is the constant LOGFILE_SQL or, if undefined, '.pdo_error'.
html()  : string
Convert Text to HTML
htmlAttribute()  : string
Format a string to be a html attribute value
array_path_get()  : mixed
Get value from an Array Path
array_path_set()  : void
Set value into array using an Array Path with / as separator.
startReportStream()  : void
Starts a new report stream, all new reports will be added to this stream.
endReportStream()  : void
Ends the current stream by setting current stream to the global one, so you can not end global stream.
transferReportStream()  : bool
Transfers the stream reports to another
addReport()  : bool
Add a report
reportSuccess()  : bool
Report a success
reportInfo()  : bool
Reports an information to the user
reportWarning()  : bool
Reports a warning
reportError()  : bool
Reports an error
hasErrorReports()  : bool
Check if there is error reports
getReports()  : array<string|int, mixed>
Get some/all reports
getFlatReports()  : array<string|int, array<string|int, mixed>>
Get some/all reports as flatten array
formatReportListToHtml()  : string
Get some/all reports as HTML
formatReportToHtml()  : string
Get one report as HTML
displayReportsHtml()  : void
Displays all reports from the list of $domain and displays generated HTML source.
htmlOptions()  : string
Generate the HTML source for options of a select tag For associative arrays, we commonly use the value=>label model (OPT_VALUE2LABEL) but sometimes for associative arrays we could prefer the label=>value model (OPT_LABEL2VALUE).
htmlOption()  : string
Generate HTML option tag
htmlDisabledAttr()  : string
Generate disabled HTML attribute
valueField()  : string
Generate HTML value attribute
array_path_html()  : string
Convert a path to an HTML name attribute E.g. user/password => user[password]
getFormData()  : array<string|int, mixed>
Get post form data
isSupportingInputController()  : bool
fillFormData()  : array<string|int, mixed>
Fill the given data from input form
fillInputValue()  : bool
Fill the given value from input form
convertSpecialChars()  : string
Convert special characters to non-special ones Replace all special characters in $string by the non-special version of theses.
b()  : string
Get the string of a boolean
explodeList()  : array<string|int, mixed>
Split a string by string in limited values
hashString()  : string
Hash string with salt
sql2Time()  : string
Get the date as string
d()  : string
Format the date as string Date format is storing a date, not a specific moment, we don't care about timezone
dt()  : string
Format the date time as string Datetime format is storing a specific moment, we care about timezone
df()  : string
Format the date time as string Datetime format is storing a specific moment, we care about timezone
timeZone()  : DateTimeZone|null
dateToTime()  : int
Convert date to time Allow any format of strtotime() to be converted to time, if time passed, it just returns it.
timeFormatToRegex()  : string
Create time format regex from date() format
parseTime()  : array<string|int, mixed>
Parse time from string to time array
sqlDate()  : string
Get the date as string in SQL format Date format is storing a date, not a specific moment, we don't care about timezone
sqlDatetime()  : string
Get the date time as string in SQL format Datetime format is storing a specific moment, we care about timezone
clientIp()  : string
Get the client public IP
userId()  : int|string
Get the id of the current user
generateRandomString()  : string
Generate a random string
dayTime()  : int
Calculate the day timestamp using the given integer Return the timestamp of the current day of $time according to the midnight hour.
leadZero()  : string
Add zero to the input number
formatDuration_Shortest()  : string
Format duration to closest unit
count_intersect_keys()  : int
Count intersect key in given arrays
getMimeType()  : string
Get the mime type of the given file path
checkDir()  : bool
Ensure path availability as folder
array_insert()  : void
Insert $value in $array at $position
array_add()  : void
Add values from an array to another
array_filter_by_keys()  : array<string|int, mixed>
Filter $array entries by $keys
array_index()  : int
Get the index of $key in $array
array_last()  : mixed|false
Get the last value of $array
array_get()  : mixed
Get value of $array at $index or $default if not found
array_apply()  : array<string|int, mixed>
Apply a user supplied function to every member of an array
array_peer()  : array<string|int, mixed>
Concat key and value in an array with a glue
str_ucfirst()  : string
Make a string's first-only character uppercase
str_ucwords()  : string
Uppercase the first-only character of each word in a string
str_first()  : string
Get the first char of a string
str_last()  : string
Get the last char of a string
reverse_values()  : void
Reverse values
between()  : bool
Check value in between min and max
deleteCookie()  : bool
Delete a HTTP cookie
startSession()  : void
Start a secured PHP Session and initialize Orpheus
is_closure()  : bool
Find whether the given variable is a closure
is_exception()  : bool
Test the given variable is an exception
ms()  : string
Get microsecond as UNIX format
parseHumanSize()  : int
Convert human size to byte unit Some programs, as of PHP, does not respect binary & decimals unit multiples 100kB = 1.000 bytes / 100KiB = 1.024 bytes In case of PHP ini file, 56MB is for PHP 56 * 1024 * 1024 bytes Source: https://en.wikipedia.org/wiki/Byte#Unit_symbol
formatHumanSize()  : string
Convert human size to byte unit You can combine $step and decimal unit as you want Source: https://en.wikipedia.org/wiki/Byte#Unit_symbol
is_email()  : bool
Check if the input is an email address.
is_string_convertible()  : bool
Check the $variable could be converted into a string
is_id()  : bool
Check if the input is an ID Number.
is_date()  : bool
Check if the input is a date.
is_time()  : bool
Check $time is a real time representation.
is_url()  : bool
Check if the input is an url.
is_ip()  : bool
Check if the input is an ip address.
now()  : DateTime
dateTime()  : DateTime
t()  : string
Translate a key
tn()  : string|null
Translate a key allowing null value (if not found)
_t()  : void
Display t()
parseNumber()  : float
Convert a localized string number into a programming one
sanitizeNumber()  : float
formatCurrency()  : string
Format money by currency and using a number formatter
formatNumber()  : string
Format a number using locale
u()  : string
Generate URL to a route
_u()  : void
Display URL to a route
exists_route()  : bool
Test if a route exists
get_current_link()  : string
Get the link of the current request
getallheaders()  : array<string|int, mixed>
id()  : string
Get the id whatever we give to it

Constants

ACCESS_PATH

public mixed ACCESS_PATH = __DIR__ . '/../public'

ADMIN_EMAIL

public mixed ADMIN_EMAIL = 'ADMIN_EMAIL_IS_MISSING'

ADMIN_EMAIL

public mixed ADMIN_EMAIL = 'admin@domain.com'

APPLICATION_PATH

public mixed APPLICATION_PATH = \ORPHEUS_PATH

AUTHOR_NAME

public mixed AUTHOR_NAME = 'AUTHOR_IS_MISSING'

AUTHOR_NAME

public mixed AUTHOR_NAME = 'Developer'

AUTHOR_WEBSITE

public mixed AUTHOR_WEBSITE = 'https://developer.com/'

CACHE_PATH

public mixed CACHE_PATH = \STORE_PATH . '/cache'

CHECK_MODULE_ACCESS

public mixed CHECK_MODULE_ACCESS = \true

COMPOSER_HOME

public mixed COMPOSER_HOME = \INSTANCE_PATH . '/.composer'

CONFIG_FOLDER

public mixed CONFIG_FOLDER = '/config'

CRAC_CONTEXT_AGENCY

public mixed CRAC_CONTEXT_AGENCY = 2

CRAC_CONTEXT_APPLICATION

public mixed CRAC_CONTEXT_APPLICATION = 1

CRAC_CONTEXT_RESOURCE

public mixed CRAC_CONTEXT_RESOURCE = 3

DATE_FORMAT_GNU

public mixed DATE_FORMAT_GNU = 1

DATE_FORMAT_LOCALE

public mixed DATE_FORMAT_LOCALE = 0

DEBUG_ENABLED

public mixed DEBUG_ENABLED = \true

DEFAULT_HOST

public mixed DEFAULT_HOST = 'APP_DOMAIN_IS_MISSING'

DEFAULT_HOST

public mixed DEFAULT_HOST = 'domain.com'

DEFAULT_LOCALE

public mixed DEFAULT_LOCALE = 'en_US'

DEFAULT_MEMBER_ROUTE

public mixed DEFAULT_MEMBER_ROUTE = \ROUTE_HOME

DEFAULT_MEMBER_ROUTE

public mixed DEFAULT_MEMBER_ROUTE = \DEFAULT_ROUTE

DEFAULT_PACKAGES

public mixed DEFAULT_PACKAGES = ['@application']

DEFAULT_PATH

public mixed DEFAULT_PATH = '/'

DEFAULT_ROUTE

public mixed DEFAULT_ROUTE = \ROUTE_HOME

DEFAULT_ROUTE

public mixed DEFAULT_ROUTE = 'home'

DEV_EMAIL

public mixed DEV_EMAIL = 'DEV_EMAIL_IS_MISSING'

DEV_EMAIL

public mixed DEV_EMAIL = 'developer@domain.com'

DEV_VERSION

public mixed DEV_VERSION = \true
Tags
deprecated

Use DEBUG_ENABLED and ApplicationKernel::isDebugEnabled()

DOMAIN_APP

public mixed DOMAIN_APP = 'application'

DOMAIN_CACHE

public mixed DOMAIN_CACHE = 'cache'

DOMAIN_COMPOSER

public mixed DOMAIN_COMPOSER = 'composer'

DOMAIN_LOGS

public mixed DOMAIN_LOGS = 'logs'

DOMAIN_SETUP

public mixed DOMAIN_SETUP = 'setup'

DOMAIN_SETUP

public mixed DOMAIN_SETUP = 'setup'

DOMAIN_TEST

public mixed DOMAIN_TEST = 'test'

DOMAIN_TRANSLATIONS

public mixed DOMAIN_TRANSLATIONS = 'translations'

DOMAIN_TRANSLATIONS

public mixed DOMAIN_TRANSLATIONS = 'translations'

DOMAIN_USER

public mixed DOMAIN_USER = 'user'

EMAIL_SENDER_NAME

public mixed EMAIL_SENDER_NAME = 'Application name'

ENTITY_CLASS_CHECK

public mixed ENTITY_CLASS_CHECK = \true

ENTITY_DESCRIPTOR_CONFIG_FOLDER

public mixed ENTITY_DESCRIPTOR_CONFIG_FOLDER = '/entities'

ERROR_DEBUG_LEVEL

public mixed ERROR_DEBUG_LEVEL = \E_ALL

ERROR_DISPLAY_RAW

public mixed ERROR_DISPLAY_RAW = 1

ERROR_PROD_LEVEL

public mixed ERROR_PROD_LEVEL = \E_CORE_ERROR

ERROR_THROW_EXCEPTION

public mixed ERROR_THROW_EXCEPTION = 0

FACEBOOK_APP_ID

public mixed FACEBOOK_APP_ID = ''

FACEBOOK_APP_SECRET

public mixed FACEBOOK_APP_SECRET = ''

FILE_SOURCE_TYPE_DATA_URI

public mixed FILE_SOURCE_TYPE_DATA_URI = 'datauri'

FILE_SOURCE_TYPE_UPLOAD

public mixed FILE_SOURCE_TYPE_UPLOAD = 'upload'

FILE_SOURCE_TYPE_UPLOAD_CONVERTED

public mixed FILE_SOURCE_TYPE_UPLOAD_CONVERTED = 'upload_converted'

FILE_SOURCE_TYPE_WKPDF

public mixed FILE_SOURCE_TYPE_WKPDF = 'wkpdf'

FILE_STORE_PATH

public mixed FILE_STORE_PATH = \STORE_PATH . '/files'

FILE_USAGE_INVOICE

public mixed FILE_USAGE_INVOICE = 'invoice'

FILE_USAGE_USER_PICTURE

public mixed FILE_USAGE_USER_PICTURE = 'user_picture'

HTTP_BAD_REQUEST

public mixed HTTP_BAD_REQUEST = 400

HTTP_FORBIDDEN

public mixed HTTP_FORBIDDEN = 403

HTTP_FOUND

public mixed HTTP_FOUND = 302

HTTP_INTERNAL_SERVER_ERROR

public mixed HTTP_INTERNAL_SERVER_ERROR = 500

HTTP_MOVED_PERMANENTLY

public mixed HTTP_MOVED_PERMANENTLY = 301

HTTP_MOVED_TEMPORARILY

public mixed HTTP_MOVED_TEMPORARILY = \HTTP_FOUND

HTTP_NOT_FOUND

public mixed HTTP_NOT_FOUND = 404

HTTP_OK

http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

public mixed HTTP_OK = 200

HTTP_UNAUTHORIZED

public mixed HTTP_UNAUTHORIZED = 401

IMAGES_URL

public mixed IMAGES_URL = \STATIC_ASSETS_URL . '/images'

INSTANCE_ID

public mixed INSTANCE_ID = 'orpheus.local'

INSTANCE_PATH

public mixed INSTANCE_PATH = \APPLICATION_PATH

IS_CONSOLE

public mixed IS_CONSOLE = \PHP_SAPI === 'cli'

JS_URL

public mixed JS_URL = \STATIC_ASSETS_URL . '/js'

LANG_FOLDER

public mixed LANG_FOLDER = '/languages'

LOGFILE_DEBUG

public mixed LOGFILE_DEBUG = 'debug.log'

LOGFILE_HACK

public mixed LOGFILE_HACK = 'hack.log'

LOGFILE_NOT_FOUND

public mixed LOGFILE_NOT_FOUND = 'not-found.log'

LOGFILE_SQL

public mixed LOGFILE_SQL = 'sql.log'

LOGFILE_SYSTEM

public mixed LOGFILE_SYSTEM = 'system.log'

LOGS_PATH

public mixed LOGS_PATH = \STORE_PATH . '/logs'

OPT_ENTITY

public mixed OPT_ENTITY = 4

OPT_KEY

public mixed OPT_KEY = \OPT_VALUE_IS_KEY | \OPT_LABEL_IS_KEY

OPT_LABEL2VALUE

public mixed OPT_LABEL2VALUE = \OPT_VALUE_IS_VALUE | \OPT_LABEL_IS_KEY

OPT_LABEL_IS_KEY

public mixed OPT_LABEL_IS_KEY = 2

OPT_LABEL_IS_VALUE

public mixed OPT_LABEL_IS_VALUE = 0

OPT_VALUE

public mixed OPT_VALUE = \OPT_VALUE_IS_VALUE | \OPT_LABEL_IS_VALUE

OPT_VALUE2LABEL

public mixed OPT_VALUE2LABEL = \OPT_VALUE_IS_KEY | \OPT_LABEL_IS_VALUE

OPT_VALUE_IS_KEY

public mixed OPT_VALUE_IS_KEY = 1

OPT_VALUE_IS_VALUE

public mixed OPT_VALUE_IS_VALUE = 0

ORPHEUS_PATH

public mixed ORPHEUS_PATH = '..'

REPLY_EMAIL

public mixed REPLY_EMAIL = 'no-reply@domain.com'

ROUTE_ADM_HOME

public mixed ROUTE_ADM_HOME = 'admin_home'

ROUTE_ADM_MY_SETTINGS

public mixed ROUTE_ADM_MY_SETTINGS = 'adm_my_settings'

ROUTE_ADM_USER

public mixed ROUTE_ADM_USER = 'adm_user'

ROUTE_ADM_USER_LIST

public mixed ROUTE_ADM_USER_LIST = 'adm_user_list'

ROUTE_DEV_APP_TRANSLATE

public mixed ROUTE_DEV_APP_TRANSLATE = 'dev_translate'

ROUTE_DEV_COMPOSER

public mixed ROUTE_DEV_COMPOSER = 'dev_composer'

ROUTE_DEV_CONFIG

public mixed ROUTE_DEV_CONFIG = 'dev_config'

ROUTE_DEV_ENTITIES

public mixed ROUTE_DEV_ENTITIES = 'dev_entities'

ROUTE_DEV_HOME

public mixed ROUTE_DEV_HOME = 'dev_home'

ROUTE_DEV_LOG_VIEW

public mixed ROUTE_DEV_LOG_VIEW = 'dev_log_view'

ROUTE_DEV_LOGS

public mixed ROUTE_DEV_LOGS = 'dev_logs'

ROUTE_DEV_SYSTEM

public mixed ROUTE_DEV_SYSTEM = 'dev_system'

ROUTE_DOWNLOAD_LATEST

public mixed ROUTE_DOWNLOAD_LATEST = 'download_latest'

ROUTE_DOWNLOAD_RELEASES

public mixed ROUTE_DOWNLOAD_RELEASES = 'download_releases'

ROUTE_FILE_DOWNLOAD

public mixed ROUTE_FILE_DOWNLOAD = 'file_download'

ROUTE_HOME

public mixed ROUTE_HOME = 'home'

ROUTE_USER_LOGIN

public mixed ROUTE_USER_LOGIN = 'login'

ROUTE_USER_LOGOUT

public mixed ROUTE_USER_LOGOUT = 'logout'
public mixed SESSION_COOKIE_LIFETIME = 86400 * 7
public mixed SESSION_COOKIE_PATH = '/'

SESSION_SHARE_ACROSS_SUBDOMAIN

public mixed SESSION_SHARE_ACROSS_SUBDOMAIN = \false

SRC_PATH

public mixed SRC_PATH = \APPLICATION_PATH . '/src'

STATIC_ASSETS_URL

public mixed STATIC_ASSETS_URL = \WEB_ROOT . '/static'

STORE_PATH

public mixed STORE_PATH = \INSTANCE_PATH . '/store'

STYLE_URL

public mixed STYLE_URL = \STATIC_ASSETS_URL . '/style'

SYSTEM_TIME_FORMAT

public mixed SYSTEM_TIME_FORMAT = 'H:M'

TEMP_PATH

public mixed TEMP_PATH = \STORE_PATH . '/temp'

THEMES_FOLDER

public mixed THEMES_FOLDER = '/themes'

THEMES_PATH

public mixed THEMES_PATH = \ACCESS_PATH . \THEMES_FOLDER

THEMES_PATH

public mixed THEMES_PATH = \ACCESS_PATH . \THEMES_FOLDER

TRANSLATIONS_PATH

public mixed TRANSLATIONS_PATH = \STORE_PATH . '/translations'

VENDOR_PATH

public mixed VENDOR_PATH = \INSTANCE_PATH . '/vendor'

VENDOR_URL

public mixed VENDOR_URL = \STATIC_ASSETS_URL . '/vendor'

WEB_ROOT

public mixed WEB_ROOT = \SCHEME . '://' . \HOST . (\PATH !== '/' ? \PATH : '')

Functions

displayByteRow()

displayByteRow(string $label, int $value) : void
Parameters
$label : string
$value : int

displayRow()

displayRow(string $label, string $value) : void
Parameters
$label : string
$value : string

rowStaticInput()

rowStaticInput(string $id, string $label, string $value) : void
Parameters
$id : string
$label : string
$value : string
Tags
author

Florent HAZARD f.hazard@sowapps.com

collapsiblePanelHTML()

collapsiblePanelHTML(string $id, string $title, string $description, string $panelClass[, bool $open = false ]) : void
Parameters
$id : string
$title : string
$description : string
$panelClass : string
$open : bool = false

listFileUsages()

listFileUsages() : array<string|int, mixed>
Return values
array<string|int, mixed>

listFileSourceTypes()

listFileSourceTypes() : array<string|int, mixed>
Return values
array<string|int, mixed>

writeText()

writeText(mixed $text) : void
Parameters
$text : mixed

writeInfo()

writeInfo(mixed $text) : void
Parameters
$text : mixed

writeSuccess()

writeSuccess(mixed $text) : void
Parameters
$text : mixed

parseYesNoValue()

parseYesNoValue(string|false $value[, string $default = 'y' ]) : bool
Parameters
$value : string|false
$default : string = 'y'
Return values
bool

getComposerRevisions()

getComposerRevisions(string $path) : array<string|int, mixed>
Parameters
$path : string
Return values
array<string|int, mixed>

sendAdminRegistrationEmail()

sendAdminRegistrationEmail(User $user) : void
Parameters
$user : User

defifn()

Define an undefined constant.

defifn(string $name, string|int|bool $value) : true
Parameters
$name : string

The name of the constant.

$value : string|int|bool

The value of the constant.

Return values
true

if the constant was defined successfully, else False.

safeConstant()

Get the nullable value of the constant

safeConstant(string $name) : mixed|null
Parameters
$name : string
Return values
mixed|null

The value of constant or null if undefined

getParentPath()

Gets the directory path

getParentPath(string $path) : string
Parameters
$path : string

The path get parent directory

Tags
see
dirname()
Return values
string

The secured path

pathOf()

Gets the path of a file/directory.

pathOf(string $relativePath[, bool $silent = false ]) : string|null

This function uses global variable $APP_SOURCE_PATHS to get the known paths. It allows developers to get a dynamic path to a file.

Parameters
$relativePath : string

The common path

$silent : bool = false

Do not throw exception if path does not exist

Tags
see
addSrcPath()
Return values
string|null

The first valid path or null if there is no valid one.

existsPathOf()

Checks if the path exists.

existsPathOf(string $commonPath[, string|null &$path = null ]) : bool

This function uses pathOf() to determine possible path of $commonPath and checks if there is any file with this path in file system.

Parameters
$commonPath : string

The common path

$path : string|null = null

The output parameter to get the first valid path

Tags
throws
Exception
see
pathOf()
Return values
bool

addSrcPath()

Add the path to the known paths

addSrcPath(string $path) : bool
Parameters
$path : string

The source path to add.

Tags
see
pathOf()
Return values
bool

True if the path was added.

listSrcPath()

List all source paths

listSrcPath() : array<string|int, string>
Return values
array<string|int, string>

includeFolder()

Include a directory

includeFolder(string $folder[, array<string|int, mixed> $importants = [] ]) : int
Parameters
$folder : string

The directory to include.

$importants : array<string|int, mixed> = []

The files in that are importants to load first.

Return values
int

The number of files included.

Include all files with a name beginning by '_' in the directory $dir. It browses recursively through sub folders.

escapeText()

Escape the text $str from special characters

escapeText(string $str[, int $flags = ENT_NOQUOTES ]) : string
Parameters
$str : string

The string to escape

$flags : int = ENT_NOQUOTES

The flags of htmlentities()

Return values
string

The escaped string

http_response_code_text()

http_response_code_text([int|null $code = null ]) : mixed
Parameters
$code : int|null = null

displayException()

displayException(Throwable $Exception) : never
Parameters
$Exception : Throwable
Return values
never

displayExceptionAsHTML()

displayExceptionAsHTML(Throwable $Exception) : never
Parameters
$Exception : Throwable
Return values
never

displayExceptionAsText()

displayExceptionAsText(Throwable $Exception) : never
Parameters
$Exception : Throwable
Return values
never

typeOf()

typeOf(mixed $var) : string
Parameters
$var : mixed
Return values
string

displayRawException()

displayRawException(Throwable $Exception) : void
Parameters
$Exception : Throwable

displayStackTraceAsHtml()

displayStackTraceAsHtml(array<string|int, mixed> $backtrace) : void
Parameters
$backtrace : array<string|int, mixed>

displayExceptionStackTrace()

displayExceptionStackTrace(Throwable $Exception) : void
Parameters
$Exception : Throwable

getClassName()

getClassName(object|string $var) : string
Parameters
$var : object|string
Return values
string

processException()

processException(Throwable $exception[, mixed $log = null ]) : void
Parameters
$exception : Throwable
$log : mixed = null

getErrorException()

getErrorException(array<string|int, mixed> $error) : ErrorException
Parameters
$error : array<string|int, mixed>
Return values
ErrorException

convertExceptionAsHTMLPage()

convertExceptionAsHTMLPage(Throwable $exception, int $code) : string
Parameters
$exception : Throwable
$code : int
Return values
string

convertExceptionAsText()

convertExceptionAsText(Throwable $Exception, int $code) : string
Parameters
$Exception : Throwable
$code : int
Return values
string

formatSourceAsText()

formatSourceAsText(mixed $file, int $activeLineNumber, int $linesBefore, int $linesAfter) : string
Parameters
$file : mixed
$activeLineNumber : int
$linesBefore : int
$linesAfter : int
Return values
string

getFileLines()

getFileLines(mixed $file, int $from, int $to[, int &$count = 0 ][, bool $asArray = false ]) : array<string|int, mixed>|string
Parameters
$file : mixed
$from : int
$to : int
$count : int = 0
$asArray : bool = false
Return values
array<string|int, mixed>|string

str_limit()

Limits the length of a string and append $end.

str_limit(string $string, int $max[, string $end = '...' ]) : string

This function do it cleanly, it tries to cut before a word.

Parameters
$string : string

The string to limit length.

$max : int

The maximum length of the string.

$end : string = '...'

A string to append to the shortened string.

Return values
string

The shortened string.

matchBits()

Do a binary test to check $value is matching $reference

matchBits(int $value, int $reference) : bool
Parameters
$value : int

The value to compare.

$reference : int

The reference for the comparison.

Return values
bool

True if $value is binary included in $reference. Do a binary test, compare $value with $reference. This function is very useful to do binary comparison for rights and inclusion in a value.

scanFolder()

Scans a directory cleanly.

scanFolder(string $dir[, bool $reverseOrder = false ]) : array<string|int, string>
Parameters
$dir : string

The path to the directory to scan.

$reverseOrder : bool = false

True to reverse results order. Default value is False.

Tags
noinspection

PhpAutovivificationOnFalseValuesInspection

Return values
array<string|int, string>

An array of the files in this directory.

stringify()

Stringify any variable

stringify(mixed $s) : string
Parameters
$s : mixed

the input data to stringify

Return values
string

toHtml()

Convert a variable to an HTML-readable string

toHtml(mixed $value) : string
Parameters
$value : mixed

the input data to stringify

Tags
see
toString()
Return values
string

toString()

Convert a variable a Text-readable string

toString(mixed $value) : string
Parameters
$value : mixed

the input data to stringify

Tags
see
toHtml()
Return values
string

formatException()

Format the input Exception to a human-readable string

formatException(Throwable $e) : string
Parameters
$e : Throwable
Return values
string

getDebugTrace()

Get the debug trace filtered by $filterStartWith

getDebugTrace([string|null $filterStartWith = null ]) : array<string|int, mixed>
Parameters
$filterStartWith : string|null = null

Exclude functions starting with this value

Return values
array<string|int, mixed>

The filtered backtrace

log_report()

Log a report in a file.

log_report(string|Exception $report, string $file[, string|null $action = null ]) : void

Data are serialized to JSON. Each line of the file is a JSON string of the reports. The log folder is the constant LOGS_PATH.

Parameters
$report : string|Exception

The report to log.

$file : string

The log file path.

$action : string|null = null

The action associated to the report. Default value is an empty string.

Tags
warning

This function require a writable log file.

log_debug()

Log a debug

log_debug(string $report[, string|null $action = null ]) : void

Log a debug. The log file is the constant LOGFILE_DEBUG.

Parameters
$report : string

The debug report to log.

$action : string|null = null

The action associated to the report. Default value is an empty string.

Tags
see
log_report()

log_hack()

Log a hack attempt The log file is the constant LOGFILE_HACK or, if undefined, '.hack'.

log_hack(string $report[, string|null $action = null ]) : void
Parameters
$report : string

The report to log.

$action : string|null = null

The action associated to the report. Default value is an empty string.

Tags
see
log_report()

log_error()

Log a system error The log file is the constant LOGFILE_SYSTEM or, if undefined, '.log_error'.

log_error(string|Throwable $report[, string|null $action = null ]) : void
Parameters
$report : string|Throwable

The report to log.

$action : string|null = null

The action associated to the report. Default value is an empty string.

Tags
see
log_report()

sql_error()

Log a sql error The log file is the constant LOGFILE_SQL or, if undefined, '.pdo_error'.

sql_error(string|Exception $report[, string|null $action = null ]) : void
Parameters
$report : string|Exception

The report to log

$action : string|null = null

The action associated to the report. Default value is an empty string

Tags
see
log_report()

html()

Convert Text to HTML

html(string $text) : string
Parameters
$text : string

The string to convert

Return values
string

htmlAttribute()

Format a string to be a html attribute value

htmlAttribute(mixed $value) : string
Parameters
$value : mixed

The variable to format

Return values
string

The escaped string

array_path_get()

Get value from an Array Path

array_path_get(array<string|int, mixed> $array, string $path[, mixed $default = null ][, bool $pathRequired = false ]) : mixed

Get value from an Array Path using / as separator. Return null if parameters are invalids, $default if the path is not found else the value. If $default is not null and returned value is null, you can infer your parameters are invalids.

Parameters
$array : array<string|int, mixed>

The array to get the value from.

$path : string

The path used to browse the array.

$default : mixed = null

The default value returned if array is valid but key is not found.

$pathRequired : bool = false

True if the path is required. Default value is False.

Return values
mixed

The value from $path in $array.

array_path_set()

Set value into array using an Array Path with / as separator.

array_path_set(array<string|int, mixed>|null &$array, string $path, mixed $value[, bool $overwrite = true ]) : void
Parameters
$array : array<string|int, mixed>|null

$array The array to get the value from.

$path : string

The path used to browse the array.

$value : mixed

The value to set in array

$overwrite : bool = true

True to overwrite existing value. Default value is True.

Tags
see
array_path_get()

startReportStream()

Starts a new report stream, all new reports will be added to this stream.

startReportStream(string $stream) : void
Parameters
$stream : string

The new report stream name

Tags
see
endReportStream()

endReportStream()

Ends the current stream by setting current stream to the global one, so you can not end global stream.

endReportStream() : void
Tags
see
startReportStream()

transferReportStream()

Transfers the stream reports to another

transferReportStream([string|null $from = null ][, string $to = 'global' ]) : bool
Parameters
$from : string|null = null

Transfers $from this stream. Default value is null (current stream).

$to : string = 'global'

Transfers $to this stream. Default value is global.

Return values
bool

addReport()

Add a report

addReport(mixed $report, string $type[, string|null $domain = null ][, string|null $code = null ][, int $severity = 0 ]) : bool

Add the report $message to the list of reports for this $type. The type of the message is commonly 'success' or 'error'.

Parameters
$report : mixed

The report (Commonly a string or an UserException).

$type : string

The type of the message.

$domain : string|null = null

The domain to use to automatically translate the message. Default value is 'global'.

$code : string|null = null

The key code to use for this report. Default is $report.

$severity : int = 0

The severity of report. Default value is 0.

Tags
see

reportSuccess(), reportError()

Return values
bool

False if rejected

reportSuccess()

Report a success

reportSuccess(mixed $report[, string|null $domain = null ]) : bool

Adds the report $message to the list of reports for this type 'success'.

Parameters
$report : mixed

The message to report.

$domain : string|null = null

The domain fo the message. Not used for translation. Default value is global.

Tags
see
addReport()
Return values
bool

False if rejected

reportInfo()

Reports an information to the user

reportInfo(mixed $report[, string|null $domain = null ]) : bool

Adds the report $message to the list of reports for this type 'info'.

Parameters
$report : mixed

The message to report.

$domain : string|null = null

The domain fo the message. Not used for translation. Default value is global.

Tags
see
addReport()
Return values
bool

False if rejected

reportWarning()

Reports a warning

reportWarning(mixed $report[, string|null $domain = null ]) : bool

Adds the report $message to the list of reports for this type 'warning'. Warning come in some special cases, we meet it when we do automatic checks before loading contents and there is something to report to the user.

Parameters
$report : mixed

The message to report.

$domain : string|null = null

The domain fo the message. Not used for translation. Default value is the domain of Exception in case of UserException else 'global'.

Tags
see
addReport()
Return values
bool

False if rejected

reportError()

Reports an error

reportError(mixed $report[, string|null $domain = null ][, int $severity = 1 ]) : bool
Parameters
$report : mixed

The report.

$domain : string|null = null

The domain fo the message. Default value is the domain of Exception in case of UserException else 'global'.

$severity : int = 1

The severity of the error, commonly 1 for standard user error and 0 for warning. Default value is 1.

Tags
see
addReport()

Adds the report $message to the list of reports for this type 'error'.

Return values
bool

False if rejected

hasErrorReports()

Check if there is error reports

hasErrorReports() : bool
Return values
bool

True if there is any error report.

getReports()

Get some/all reports

getReports([string $stream = 'global' ][, string|null $type = null ][, bool $delete = true ]) : array<string|int, mixed>

Get all reports from the list of $domain optionally filtered by type.

Parameters
$stream : string = 'global'

The stream to get the reports. Default value is "global".

$type : string|null = null

Filter results by report type. Default value is null.

$delete : bool = true

True to delete entries from the list. Default value is true.

Tags
see
formatReportListToHtml()
Return values
array<string|int, mixed>

getFlatReports()

Get some/all reports as flatten array

getFlatReports([string $stream = 'global' ][, string|null $type = null ][, bool $delete = true ]) : array<string|int, array<string|int, mixed>>

Get all reports from the list of $domain optionally filtered by type.

Parameters
$stream : string = 'global'

The stream to get the reports. Default value is "global".

$type : string|null = null

Filter results by report type. Default value is null.

$delete : bool = true

True to delete entries from the list. Default value is true.

Tags
see
getReports()
Return values
array<string|int, array<string|int, mixed>>

formatReportListToHtml()

Get some/all reports as HTML

formatReportListToHtml([string $stream = 'global' ][, array<string|int, mixed> $rejected = [] ][, bool $delete = true ]) : string

Get all reports from the list of $domain and generates the HTML source to display.

Parameters
$stream : string = 'global'

The stream to get the reports. Default value is 'global'.

$rejected : array<string|int, mixed> = []

An array of rejected messages. Default value is an empty array.

$delete : bool = true

True to delete entries from the list. Default value is true.

Tags
see
displayReportsHtml()
see
formatReportToHtml()
Return values
string

The renderer HTML.

formatReportToHtml()

Get one report as HTML

formatReportToHtml(string $stream, string $report, string $domain, string $type) : string
Parameters
$stream : string

The stream of the report.

$report : string

The message to report.

$domain : string

The domain of the report.

$type : string

The type of the report.

Return values
string

displayReportsHtml()

Displays all reports from the list of $domain and displays generated HTML source.

displayReportsHtml([string $stream = 'global' ][, array<string|int, string> $rejected = [] ][, bool $delete = true ]) : void
Parameters
$stream : string = 'global'

The stream to display. Default value is 'global'.

$rejected : array<string|int, string> = []

An array of rejected messages. Can be the first parameter.

$delete : bool = true

True to delete entries from the list.

Tags
see
formatReportListToHtml()

htmlOptions()

Generate the HTML source for options of a select tag For associative arrays, we commonly use the value=>label model (OPT_VALUE2LABEL) but sometimes for associative arrays we could prefer the label=>value model (OPT_LABEL2VALUE).

htmlOptions(string|null $fieldPath, array<string|int, mixed> $values[, null $default = null ][, int|null $matches = null ][, string $prefix = '' ][, string $domain = 'global' ]) : string

You can use your own combination with defined constants OPT_VALUE_IS_VALUE, OPT_VALUE_IS_KEY, OPT_LABEL_IS_VALUE and OPT_LABEL_IS_KEY. Common combinations are OPT_LABEL2VALUE, OPT_VALUE2LABEL and OPT_VALUE. The label is prefixed with $prefix and translated using t(). This function allows bi-dimensional arrays in $values, used as option group.

Parameters
$fieldPath : string|null

The name path to the field.

$values : array<string|int, mixed>

The values to build the dropdown menu.

$default : null = null

The default selected value. Default value is null (no selection).

$matches : int|null = null

Define the associativity between array and option values. Default value is OPT_VALUE2LABEL (as null).

$prefix : string = ''

The prefix to use for the text name of values. Default value is an empty string.

$domain : string = 'global'

The domain to apply the Key. Default value is 'global'.

Tags
see
htmlOption()
Return values
string

An HTML source for the built SELECT tag.

htmlOption()

Generate HTML option tag

htmlOption(string $elValue[, string|null $label = null ][, bool $selected = false ][, string $addAttr = '' ]) : string
Parameters
$elValue : string
$label : string|null = null
$selected : bool = false
$addAttr : string = ''
Return values
string

htmlDisabledAttr()

Generate disabled HTML attribute

htmlDisabledAttr() : string
Return values
string

valueField()

Generate HTML value attribute

valueField(string $value) : string
Parameters
$value : string

The value

Return values
string

array_path_html()

Convert a path to an HTML name attribute E.g. user/password => user[password]

array_path_html(string $path) : string
Parameters
$path : string
Return values
string

getFormData()

Get post form data

getFormData() : array<string|int, mixed>
Return values
array<string|int, mixed>

isSupportingInputController()

isSupportingInputController() : bool
Return values
bool

fillFormData()

Fill the given data from input form

fillFormData(array<string|int, mixed>|null &$data) : array<string|int, mixed>
Parameters
$data : array<string|int, mixed>|null

The data to fill, as pointer.

Tags
see
getFormData()

Fill the given pointer data array with input form data if null. This function is designed to only offset the case where $data is null.

Return values
array<string|int, mixed>

The resulting $data.

fillInputValue()

Fill the given value from input form

fillInputValue(mixed &$value, string $fieldPath[, string|null $default = null ][, bool $pathRequired = false ]) : bool
Parameters
$value : mixed

The value to fill, as pointer.

$fieldPath : string

The array_path to the input form value.

$default : string|null = null

The default value if not found. Default value is null (array_path_get()'s default).

$pathRequired : bool = false

True if the path is required. Default value is False (array_path_get()'s default).

Tags
see
getFormData()
see
array_path_get()

Fill the given pointer value with input form data or uses default.

Return values
bool

True if got value is not null (found).

convertSpecialChars()

Convert special characters to non-special ones Replace all special characters in $string by the non-special version of theses.

convertSpecialChars(string $string) : string
Parameters
$string : string

The string to convert

Return values
string

The string wih no special characters

b()

Get the string of a boolean

b(bool $b) : string
Parameters
$b : bool

The boolean

Return values
string

The boolean's string

explodeList()

Split a string by string in limited values

explodeList(string $delimiter, string $string, int $limit[, mixed $default = null ]) : array<string|int, mixed>
Parameters
$delimiter : string

The boundary string

$string : string

The input string

$limit : int

The limit of values exploded

$default : mixed = null

The default value to use if missing

Tags
see
explode()

Split a string by string in a limited number of values. The main difference with explode() is this function complete missing values with $default. If you want $limit optional, use explode()

Return values
array<string|int, mixed>

The exploded array with a defined limit of values.

hashString()

Hash string with salt

hashString(string $value) : string
Parameters
$value : string
Return values
string

Hash input string with salt (constant USER_SALT) using SHA512

sql2Time()

Get the date as string

sql2Time(string $datetime) : string
Parameters
$datetime : string

The datetime

Return values
string

The date using 'dateFormat' translation key

Date format is storing a date, not a specific moment, we don't care about timezone

d()

Format the date as string Date format is storing a date, not a specific moment, we don't care about timezone

d([int|DateTime $time = TIME ][, bool $utc = false ]) : string
Parameters
$time : int|DateTime = TIME

The UNIX timestamp

$utc : bool = false

Is the time UTC

Return values
string

The date using 'dateFormat' translation key

dt()

Format the date time as string Datetime format is storing a specific moment, we care about timezone

dt([int|DateTime $time = TIME ][, bool $utc = false ]) : string
Parameters
$time : int|DateTime = TIME

The UNIX timestamp

$utc : bool = false

Is the time UTC

Return values
string

The date using 'datetimeFormat' translation key

df()

Format the date time as string Datetime format is storing a specific moment, we care about timezone

df(string $format[, int|DateTime|null $time = TIME ][, string|false|null $timeZone = null ]) : string
Parameters
$format : string

The format to use

$time : int|DateTime|null = TIME

The UNIX timestamp

$timeZone : string|false|null = null

Timezone to use. False for UTC, Null for default or a string to specify the one to use

Return values
string

The date formatted using $format

timeZone()

timeZone(string|DateTimeZone|null $timeZone) : DateTimeZone|null
Parameters
$timeZone : string|DateTimeZone|null
Tags
throws
Exception
Return values
DateTimeZone|null

dateToTime()

Convert date to time Allow any format of strtotime() to be converted to time, if time passed, it just returns it.

dateToTime(int|string|DateTime $date) : int
Parameters
$date : int|string|DateTime

The date or UNIX timestamp

Return values
int

The UNIX timestamp

timeFormatToRegex()

Create time format regex from date() format

timeFormatToRegex(string $format) : string
Parameters
$format : string
Return values
string

parseTime()

Parse time from string to time array

parseTime(string $time[, string $format = SYSTEM_TIME_FORMAT ]) : array<string|int, mixed>
Parameters
$time : string

Parsed time

$format : string = SYSTEM_TIME_FORMAT

Format to use

Tags
throws
Exception
Return values
array<string|int, mixed>

sqlDate()

Get the date as string in SQL format Date format is storing a date, not a specific moment, we don't care about timezone

sqlDate([int|DateTime|string|null $time = TIME ]) : string
Parameters
$time : int|DateTime|string|null = TIME

The UNIX timestamp.

Return values
string

The date using sql format

sqlDatetime()

Get the date time as string in SQL format Datetime format is storing a specific moment, we care about timezone

sqlDatetime([int|DateTime|string|null $time = TIME ][, string $format = 'Y-m-d H:i:s' ]) : string
Parameters
$time : int|DateTime|string|null = TIME

The UNIX timestamp.

$format : string = 'Y-m-d H:i:s'
Return values
string

The date using sql format

clientIp()

Get the client public IP

clientIp() : string
Return values
string

The ip of the client

userId()

Get the id of the current user

userId() : int|string
Return values
int|string

The user's id

generateRandomString()

Generate a random string

generateRandomString([int $length = 64 ][, string $keyspace = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' ]) : string
Parameters
$length : int = 64

The length of the output string

$keyspace : string = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'

A string of all possible characters to select from

Return values
string

dayTime()

Calculate the day timestamp using the given integer Return the timestamp of the current day of $time according to the midnight hour.

dayTime([int|null $time = null ][, bool $gmt = true ]) : int
Parameters
$time : int|null = null

The time to get the day time. Default value is current timestamp.

$gmt : bool = true

Is the time GMT

Return values
int

leadZero()

Add zero to the input number

leadZero(int $number[, int $length = 2 ]) : string
Parameters
$number : int

The number

$length : int = 2

The length to add zero

Return values
string

formatDuration_Shortest()

Format duration to closest unit

formatDuration_Shortest(int $duration) : string
Parameters
$duration : int

Duration in seconds

Return values
string

count_intersect_keys()

Count intersect key in given arrays

count_intersect_keys(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : int
Parameters
$array1 : array<string|int, mixed>
$array2 : array<string|int, mixed>
Return values
int

getMimeType()

Get the mime type of the given file path

getMimeType(string $filePath) : string
Parameters
$filePath : string
Return values
string

checkDir()

Ensure path availability as folder

checkDir(string $filePath) : bool
Parameters
$filePath : string
Return values
bool

array_insert()

Insert $value in $array at $position

array_insert(array<string|int, mixed> &$array, int $position, mixed $value) : void
Parameters
$array : array<string|int, mixed>
$position : int
$value : mixed
Tags
set

array_splice()

array_add()

Add values from an array to another

array_add(array<string|int, mixed> &$array, array<string|int, mixed> $other) : void
Parameters
$array : array<string|int, mixed>
$other : array<string|int, mixed>

array_filter_by_keys()

Filter $array entries by $keys

array_filter_by_keys(array<string|int, mixed> $array, array<string|int, mixed> $keys) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>
$keys : array<string|int, mixed>
Return values
array<string|int, mixed>

array_index()

Get the index of $key in $array

array_index(array<string|int, mixed> $array, string|int $key) : int
Parameters
$array : array<string|int, mixed>
$key : string|int
Return values
int

array_last()

Get the last value of $array

array_last(array<string|int, mixed> $array) : mixed|false
Parameters
$array : array<string|int, mixed>
Return values
mixed|false

array_get()

Get value of $array at $index or $default if not found

array_get(array<string|int, mixed> $array, int $index[, mixed $default = null ]) : mixed
Parameters
$array : array<string|int, mixed>
$index : int
$default : mixed = null

array_apply()

Apply a user supplied function to every member of an array

array_apply(array<string|int, mixed> $array, callable $callback[, mixed $userdata = null ][, string &$success = null ]) : array<string|int, mixed>
Parameters
$array : array<string|int, mixed>

The input array.

$callback : callable

Typically, callback takes on two parameters. The array parameter's value being the first, and the key/index second.

$userdata : mixed = null

If the optional userdata parameter is supplied, it will be passed as the third parameter to the callback.

$success : string = null

TRUE on success or FALSE on failure.

Return values
array<string|int, mixed>

The resulting array

array_peer()

Concat key and value in an array with a glue

array_peer(array<string|int, string> $array[, string $peerGlue = ': ' ]) : array<string|int, mixed>
Parameters
$array : array<string|int, string>
$peerGlue : string = ': '
Return values
array<string|int, mixed>

str_ucfirst()

Make a string's first-only character uppercase

str_ucfirst(string $value) : string
Parameters
$value : string
Return values
string

str_ucwords()

Uppercase the first-only character of each word in a string

str_ucwords(string $value) : string
Parameters
$value : string
Return values
string

str_first()

Get the first char of a string

str_first(string $value) : string
Parameters
$value : string
Return values
string

str_last()

Get the last char of a string

str_last(string $value) : string
Parameters
$value : string
Return values
string

reverse_values()

Reverse values

reverse_values(mixed &$val1, mixed &$val2) : void
Parameters
$val1 : mixed
$val2 : mixed

between()

Check value in between min and max

between(int $value, int $min, int $max) : bool
Parameters
$value : int
$min : int
$max : int
Return values
bool

deleteCookie()

Delete a HTTP cookie

deleteCookie(string $name) : bool
Parameters
$name : string

The name of the cookie to delete

Return values
bool

True if cookie was deleted, false if not found

startSession()

Start a secured PHP Session and initialize Orpheus

startSession([int $type = SESSION_WITH_COOKIE ]) : void
Parameters
$type : int = SESSION_WITH_COOKIE

The type flag of the session

is_closure()

Find whether the given variable is a closure

is_closure(mixed $value) : bool
Parameters
$value : mixed
Return values
bool

True if $v is a closure

is_exception()

Test the given variable is an exception

is_exception(mixed $exception) : bool
Parameters
$exception : mixed
Return values
bool

True if $v is an Exception

ms()

Get microsecond as UNIX format

ms([int|null $precision = null ]) : string
Parameters
$precision : int|null = null
Return values
string

parseHumanSize()

Convert human size to byte unit Some programs, as of PHP, does not respect binary & decimals unit multiples 100kB = 1.000 bytes / 100KiB = 1.024 bytes In case of PHP ini file, 56MB is for PHP 56 * 1024 * 1024 bytes Source: https://en.wikipedia.org/wiki/Byte#Unit_symbol

parseHumanSize(string $size[, bool $forceBinaryStep = false ]) : int
Parameters
$size : string

The human size to parse

$forceBinaryStep : bool = false

For to use binary step even if using decimal unit

Tags
throws
Exception
Return values
int

The byte size

formatHumanSize()

Convert human size to byte unit You can combine $step and decimal unit as you want Source: https://en.wikipedia.org/wiki/Byte#Unit_symbol

formatHumanSize(string $value[, int $step = 1000 ][, bool $useDecimalUnit = true ][, int $allowMax = 10000 ][, string $format = '%s%s' ]) : string
Parameters
$value : string

The byte size to format

$step : int = 1000

The step between units

$useDecimalUnit : bool = true

The unit to use (decimal or binary)

$allowMax : int = 10000

Max value allow in one unit. e.g. with 10.000, you keep a unit until 9.999

$format : string = '%s%s'

The format to use with sprintf(), first string is the value and the second one is the unit.

Return values
string

The formatted size

is_email()

Check if the input is an email address.

is_email(string $email) : bool
Parameters
$email : string

The email address to check.

Return values
bool

True if $email si a valid email address.

is_string_convertible()

Check the $variable could be converted into a string

is_string_convertible(mixed $variable) : bool
Parameters
$variable : mixed
Return values
bool

is_id()

Check if the input is an ID Number.

is_id(mixed $id) : bool
Parameters
$id : mixed

The number to check

Return values
bool

True if $number si a valid integer

The ID number is an integer.

is_date()

Check if the input is a date.

is_date(string $date[, bool $withTime = false ][, DateTime|null &$dateTime = null ][, int $format = DATE_FORMAT_LOCALE ]) : bool
Parameters
$date : string

The date to check.

$withTime : bool = false

True to use datetime format, optional. Default value is false.

$dateTime : DateTime|null = null

The output timestamp of the data, optional.

$format : int = DATE_FORMAT_LOCALE

The date format to check, see constants DATE_FORMAT_*

Return values
bool

True if $date si a valid date.

The date have to be well formatted and valid. The FR date format is DD/MM/YYYY and time format is HH:MM:SS Allow 01/01/1970, 01/01/1970 12:10:30, 01/01/1970 12:10 Fill missing information with 0.

is_time()

Check $time is a real time representation.

is_time(string $time[, array<string|int, mixed>|null &$matches = null ]) : bool

Could use global translation "timeFormat" to check this is a time e.g. Basically validate 12:50

Parameters
$time : string
$matches : array<string|int, mixed>|null = null
Return values
bool

is_url()

Check if the input is an url.

is_url(string $url) : bool
Parameters
$url : string

The url to check.

Return values
bool

True if $url si a valid url.

is_ip()

Check if the input is an ip address.

is_ip(string $ip[, int $flags = FILTER_DEFAULT ]) : bool
Parameters
$ip : string

The url to check.

$flags : int = FILTER_DEFAULT

The flags for the check.

Tags
sa

filter_var()

Return values
bool

True if $ip si a valid ip address.

dateTime()

dateTime([mixed $time = null ]) : DateTime
Parameters
$time : mixed = null
Tags
throws
Exception
Return values
DateTime

t()

Translate a key

t(string $key[, string|array<string|int, mixed>|null $domain = 'global' ][, array<string|int, mixed> $parameters = [] ]) : string
Parameters
$key : string

The Key to translate, prefer to use an internal language (English CamelCase).

$domain : string|array<string|int, mixed>|null = 'global'

The domain to apply the Key. Default value is 'global'.

$parameters : array<string|int, mixed> = []

The values array to replace in text. Could be used as second parameter.

Return values
string

The translated human text.

This function try to translate the given key, in case of failure, it just returns the Key. It tries to replace $values in text by key using #key# format using str_replace() but if $values is a list of values, it uses sprintf(). $values allows 3 formats:

  • array('key1'=>'value1', 'key2'=>'value2'...)
  • array(array('key1', 'key2'...), array('value1', 'value2'...))
  • array('value1', 'value2'...) This function is variadic, you can specify values with more scalar arguments.

Examples: t('untranslatedString', 'aDomain'), t('My already translated string'), t('untranslatedString', 'global', array('key1'=>'val1')), t('untranslatedString', 'global', 'val1', 60)

tn()

Translate a key allowing null value (if not found)

tn(string $key[, string|array<string|int, mixed>|null $domain = 'global' ][, array<string|int, mixed> $parameters = [] ]) : string|null
Parameters
$key : string
$domain : string|array<string|int, mixed>|null = 'global'
$parameters : array<string|int, mixed> = []
Return values
string|null

_t()

Display t()

_t(string $key[, string|array<string|int, mixed> $domain = 'global' ][, array<string|int, mixed> $parameters = [] ]) : void
Parameters
$key : string

The Key to translate, prefer to use an internal language (English CamelCase).

$domain : string|array<string|int, mixed> = 'global'

The domain to apply the Key. Default value is 'global'.

$parameters : array<string|int, mixed> = []
Tags
see
t()
deprecated

Use echo t()

parseNumber()

Convert a localized string number into a programming one

parseNumber(string $value) : float
Parameters
$value : string
Return values
float

sanitizeNumber()

sanitizeNumber(string $value) : float
Parameters
$value : string
Tags
deprecated

Use parseNumber()

Return values
float

formatCurrency()

Format money by currency and using a number formatter

formatCurrency(float $value, string $currency[, bool|int $decimals = true ]) : string
Parameters
$value : float
$currency : string
$decimals : bool|int = true

Decimals or true for 2, false for 0

Return values
string

formatNumber()

Format a number using locale

formatNumber(int|float $value[, int $decimals = 0 ]) : string
Parameters
$value : int|float
$decimals : int = 0
Return values
string

u()

Generate URL to a route

u(string $routeName[, array<string|int, mixed> $values = [] ]) : string
Parameters
$routeName : string
$values : array<string|int, mixed> = []
Return values
string

_u()

Display URL to a route

_u(string $routeName[, array<string|int, mixed> $values = [] ]) : void
Parameters
$routeName : string
$values : array<string|int, mixed> = []
Tags
deprecated

Use u() with echo

exists_route()

Test if a route exists

exists_route(string $routeName) : bool
Parameters
$routeName : string
Return values
bool

Get the link of the current request

get_current_link() : string
Return values
string

getallheaders()

getallheaders() : array<string|int, mixed>
Return values
array<string|int, mixed>

							
On this page

Search results