APPPATH
public
mixed
APPPATH
= realpath(rtrim($paths->appDirectory, '\/ ')) . DIRECTORY_SEPARATOR
GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing codeigniter4.github.io — CodeIgniter v4.7 API
Menu
DocumentationTable of ContentsPackagesNamespacesConstants
Functions
ConstantsAPPPATH
public
mixed
APPPATH
= realpath(rtrim($paths->appDirectory, '\/ ')) . DIRECTORY_SEPARATOR
APPPATH
public
mixed
APPPATH
= \realpath(\rtrim($paths->appDirectory, '\/ ')) . \DIRECTORY_SEPARATOR
COMPOSER_PATH
public
mixed
COMPOSER_PATH
= (string) \realpath(\HOMEPATH . 'vendor/autoload.php')
CURL_HTTP_VERSION_3
public
mixed
CURL_HTTP_VERSION_3
= 30
ENVIRONMENT
public
mixed
ENVIRONMENT
= $env
ENVIRONMENT
public
mixed
ENVIRONMENT
= env('CI_ENVIRONMENT', 'production')
ENVIRONMENT
public
mixed
ENVIRONMENT
= 'testing'
ROOTPATH
public
mixed
ROOTPATH
= realpath(APPPATH . '../') . DIRECTORY_SEPARATOR
ROOTPATH
public
mixed
ROOTPATH
= \realpath(\APPPATH . '../') . \DIRECTORY_SEPARATOR
STDOUT
public
mixed
STDOUT
= 'php://output'
SUPPORTPATH
public
mixed
SUPPORTPATH
= \realpath($paths->testsDirectory . '/_support/') . \DIRECTORY_SEPARATOR
SYSTEMPATH
public
mixed
SYSTEMPATH
= realpath(rtrim($paths->systemDirectory, '\/ ')) . DIRECTORY_SEPARATOR
SYSTEMPATH
public
mixed
SYSTEMPATH
= \realpath(\rtrim($paths->systemDirectory, '\/ ')) . \DIRECTORY_SEPARATOR
TESTPATH
public
mixed
TESTPATH
= realpath(rtrim($paths->testsDirectory, '\/ ')) . DIRECTORY_SEPARATOR
TESTPATH
public
mixed
TESTPATH
= \realpath(\rtrim($paths->testsDirectory, '\/ ')) . \DIRECTORY_SEPARATOR
VENDORPATH
public
mixed
VENDORPATH
= dirname($this->composerPath) . DIRECTORY_SEPARATOR
VENDORPATH
public
mixed
VENDORPATH
= \realpath(\HOMEPATH . 'vendor/') . \DIRECTORY_SEPARATOR
WRITEPATH
public
mixed
WRITEPATH
= $writePath . DIRECTORY_SEPARATOR
WRITEPATH
public
mixed
WRITEPATH
= \realpath(\rtrim($paths->writableDirectory, '\/ ')) . \DIRECTORY_SEPARATOR
Functionsapp_timezone()Returns the timezone the application has been set to display dates in. This might be different than the timezone set at the server level, as you often want to stores dates in UTC and convert them on the fly for the user.
app_timezone() : string
Return valuesstringcache()A convenience method that provides access to the Cache object. If no parameter is provided, will return the object, otherwise, will attempt to return the cached value.
cache([string|null $key = null ]) : CacheInterface : mixed)
Examples: cache()->save('foo', 'bar'); $foo = cache('bar'); Parameters
Return valuesCacheInterface : mixed)clean_path()A convenience method to clean paths for a nicer looking output. Useful for exception handling, error logging, etc.
clean_path(string $path) : string
Parameters
Return valuesstringcommand()Runs a single command.
command(string $command) : false|string
Input expected in a single string as would be used on the command line itself:
Parameters
Return valuesfalse|stringconfig()More simple way of getting config instances from Factories
config(ConfigTemplate>|string $name[, bool $getShared = true ]) : ConfigTemplate : object|null)
Parameters
Tags
Return valuesConfigTemplate : object|null)cookie()Simpler way to create a new Cookie instance.
cookie(string $name[, string $value = '' ][, DateTimeInterface|int|string, path?: string, domain?: string, secure?: bool, httponly?: bool, samesite?: string, raw?: bool} $options = [] ]) : Cookie
Parameters
Tags
Return valuesCookiecookies()Fetches the global `CookieStore` instance held by `Response`.
cookies([array<int, Cookie> $cookies = [] ][, bool $getGlobal = true ]) : CookieStore
Parameters
Return valuesCookieStorecsrf_token()Returns the CSRF token name.
csrf_token() : string
Can be used in Views when building hidden inputs manually, or used in javascript vars when using APIs. Return valuesstringcsrf_header()Returns the CSRF header name.
csrf_header() : string
Can be used in Views by adding it to the meta tag or used in javascript to define a header name when using APIs. Return valuesstringcsrf_hash()Returns the current hash value for the CSRF protection.
csrf_hash() : string
Can be used in Views when building hidden inputs manually, or used in javascript vars for API usage. Return valuesstringcsrf_field()Generates a hidden input field for use within manually generated forms.
csrf_field([non-empty-string|null $id = null ]) : string
Parameters
Return valuesstringcsrf_meta()Generates a meta tag for use within javascript calls.
csrf_meta([non-empty-string|null $id = null ]) : string
Parameters
Return valuesstringcsp_style_nonce()Generates a nonce attribute for style tag.
csp_style_nonce() : string
Return valuesstringcsp_script_nonce()Generates a nonce attribute for script tag.
csp_script_nonce() : string
Return valuesstringdb_connect()Grabs a database connection and returns it to the user.
db_connect([array{DSN?: string, hostname?: string, username?: string, password?: string, database?: string, DBDriver?: "MySQLi"|"OCI8"|"Postgre"|"SQLite3"|"SQLSRV", DBPrefix?: string, pConnect?: bool, DBDebug?: bool, charset?: string, DBCollat?: string, swapPre?: string, encrypt?: bool, compress?: bool, strictOn?: bool, failover?: array
This is a convenience wrapper for \Config\Database::connect() and supports the same parameters. Namely: When passing in $db, you may pass any of the following to connect:
If $getShared === false then a new connection instance will be provided, otherwise it will all calls will return the same instance. Parameters
Return valuesBaseConnectionenv()Allows user to retrieve values from the environment variables that have been set. Especially useful for retrieving values set from the .env file for use in config files.
env(string $key[, mixed $default = null ]) : mixed
Parameters
esc()Performs simple auto-escaping of data for security reasons.
esc(array<string|int, array<string|int, mixed>|string>|string $data[, "attr"|"css"|"html"|"js"|"raw"|"url" $context = 'html' ][, string|null $encoding = null ]) : ($data is string ? string : array
Might consider making this more complex at a later date. If $data is a string, then it simply escapes and returns it. If $data is an array, then it loops over it, escaping each 'value' of the key/value pairs. Parameters
Tags
Return values($data is string ? string : arrayforce_https()Used to force a page to be accessed in via HTTPS.
force_https([int $duration = 31536000 ][, RequestInterface|null $request = null ][, ResponseInterface|null $response = null ]) : void
Uses a standard redirect, plus will set the HSTS header for modern browsers that support, which gives best protection against man-in-the-middle attacks. Parameters
Tagsfunction_usable()Function usable
function_usable(string $functionName) : bool
Executes a function_exists() check, and if the Suhosin PHP extension is loaded - checks whether the function that is checked might be disabled in there as well. This is useful as function_exists() will return FALSE for functions disabled via the disable_functions php.ini setting, but not for suhosin.executor.func.blacklist and suhosin.executor.disable_eval. These settings will just terminate script execution if a disabled function is executed. The above described behavior turned out to be a bug in Suhosin, but even though a fix was committed for 0.9.34 on 2012-02-12, that version is yet to be released. This function will therefore be just temporary, but would probably be kept for a few years. Parameters
Tags
Return valuesbool —TRUE if the function exists and is safe to call, FALSE otherwise. helper()Loads a helper file into memory. Supports namespaced helpers, both in and out of the 'Helpers' directory of a namespaced directory.
helper(array<int, string>|string $filenames) : void
Will load ALL helpers of the matching name, in the following order:
Parameters
Tags
is_cli()Check if PHP was invoked from the command line.
is_cli() : bool
Tags
Return valuesboolis_really_writable()Tests for file writability
is_really_writable(string $file) : bool
is_writable() returns TRUE on Windows servers when you really can't write to the file, based on the read-only attribute. is_writable() is also unreliable on Unix servers if safe_mode is on. Parameters
Tags
Return valuesboolis_windows()Detect if platform is running in Windows.
is_windows([bool|null $mock = null ]) : bool
Parameters
Return valuesboollang()A convenience method to translate a string or array of them and format the result with the intl extension's MessageFormatter.
lang(string $line[, array<string|int, float|int|string> $args = [] ][, string|null $locale = null ]) : array<int, string>|string
Parameters
Return valuesarray<int, string>|stringlog_message()A convenience/compatibility method for logging events through the Log system.
log_message(string $level, string $message[, array<string, mixed> $context = [] ]) : void
Allowed log levels are:
Parameters
model()More simple way of getting model instances from Factories
model(ModelTemplate>|string $name[, bool $getShared = true ][, ConnectionInterface|null &$conn = null ]) : ModelTemplate : object|null)
Parameters
Tags
Return valuesModelTemplate : object|null)old()Provides access to "old input" that was set in the session during a redirect()->withInput().
old(string $key[, string|null $default = null ][, "attr"|"css"|"html"|"js"|"raw"|"url"|false $escape = 'html' ]) : array<string|int, mixed>|string|null
Parameters
Return valuesarray<string|int, mixed>|string|nullredirect()Convenience method that works with the current global $request and $router instances to redirect using named/reverse-routed routes to determine the URL to go to.
redirect([non-empty-string|null $route = null ]) : RedirectResponse
If more control is needed, you must use $response->redirect explicitly. Parameters
Return valuesRedirectResponseremove_invisible_characters()Remove Invisible Characters
remove_invisible_characters(string $str[, bool $urlEncoded = true ]) : string
This prevents sandwiching null characters between ascii characters, like Java\0script. Parameters
Return valuesstringrender_backtrace()Renders a backtrace in a nice string format.
render_backtrace(array<int, array{file?: string, line?: int, class?: string, type?: string, function: string, args?: list}> $backtrace) : string
Parameters
Return valuesstringrequest()Returns the shared Request.
request() : CLIRequest|IncomingRequest
Return valuesCLIRequest|IncomingRequestresponse()Returns the shared Response.
response() : ResponseInterface
Return valuesResponseInterfaceroute_to()Given a route name or controller/method string and any params, will attempt to build the relative URL to the matching route.
route_to(string $method, int|string ...$params) : false|string
NOTE: This requires the controller/method to have a route defined in the routes Config file. Parameters
Return valuesfalse|string —The route (URI path relative to baseURL) or false if not found. session()A convenience method for accessing the session instance, or an item that has been set in the session.
session([string|null $val = null ]) : Session : mixed)
Examples: session()->set('foo', 'bar'); $foo = session('bar'); Parameters
Return valuesSession : mixed)service()Allows cleaner access to the Services Config file.
service(string $name, mixed ...$params) : object|null
Always returns a SHARED instance of the class, so calling the function multiple times should always return the same instance. These are equal:
Parameters
Return valuesobject|nullsingle_service()Always returns a new instance of the class.
single_service(string $name, mixed ...$params) : object|null
Parameters
Return valuesobject|nullslash_item()Fetch a config file item with slash appended (if not empty)
slash_item(string $item) : string|null
Parameters
Return valuesstring|null —The configuration item or NULL if the item doesn't exist stringify_attributes()Stringify attributes for use in HTML tags.
stringify_attributes(array<string|int, mixed>|object|string $attributes[, bool $js = false ]) : string
Helper function used to convert a string, array, or object of attributes to a string. Parameters
Return valuesstringtimer()A convenience method for working with the timer.
timer([non-empty-string|null $name = null ][, callable(): mixed|null $callable = null ]) : Timer))
If no parameter is passed, it will return the timer instance. If callable is passed, it measures time of callable and returns its return value if any. Otherwise will start or stop the timer intelligently. Parameters
Return valuesTimer))view()Grabs the current RendererInterface-compatible class and tells it to render the specified view. Simply provides a convenience method that can be used in Controllers, libraries, and routed closures.
view(string $name[, array<string, mixed> $data = [] ][, array<string, mixed> $options = [] ]) : string
NOTE: Does not provide any escaping of the data, so that must all be handled manually by the developer. Parameters
Return valuesstringview_cell()View cells are used within views to insert HTML chunks that are managed by other classes.
view_cell(string $library[, array<string|int, mixed>|string|null $params = null ][, int $ttl = 0 ][, string|null $cacheName = null ]) : string
Parameters
Tags
Return valuesstringclass_basename()Get the class "basename" of the given object / class.
class_basename(class-string|object $class) : string
Parameters
Tags
Return valuesstringclass_uses_recursive()Returns all traits used by a class, its parent classes and trait of their traits.
class_uses_recursive(class-string|object $class) : array<class-string, class-string>
Parameters
Tags
Return valuesarray<class-string, class-string>trait_uses_recursive()Returns all traits used by a trait and its traits.
trait_uses_recursive(class-string $trait) : array<class-string, class-string>
Parameters
Tags
Return valuesarray<class-string, class-string>dot_array_search()Searches an array through dot syntax. Supports wildcard searches, like foo.*.bar
dot_array_search(string $index, array<string|int, mixed> $array) : mixed
Parameters
array_deep_search()Returns the value of an element at a key in an array of uncertain depth.
array_deep_search(int|string $key, array<string|int, mixed> $array) : mixed
Parameters
array_sort_by_multiple_keys()Sorts a multidimensional array by its elements values. The array columns to be used for sorting are passed as an associative array of key names and sorting flags.
array_sort_by_multiple_keys(array<string|int, mixed> &$array, array<string, int> $sortColumns) : bool
Both arrays of objects and arrays of array can be sorted. Example: array_sort_by_multiple_keys($players, [ 'team.hierarchy' => SORT_ASC, 'position' => SORT_ASC, 'name' => SORT_STRING, ]); The '.' dot operator in the column name indicates a deeper array or object level. In principle, any number of sublevels could be used, as long as the level and column exist in every array element. For information on multi-level array sorting, refer to Example #3 here: https://www.php.net/manual/de/function.array-multisort.php Parameters
Return valuesboolarray_flatten_with_dots()Flatten a multidimensional array using dots as separators.
array_flatten_with_dots(iterable<string|int, mixed> $array[, string $id = '' ]) : array<string, mixed>
Parameters
Return valuesarray<string, mixed> —The flattened array array_group_by()Groups all rows by their index values. Result's depth equals number of indexes
array_group_by(array<string|int, mixed> $array, array<int, string> $indexes[, bool $includeEmpty = false ]) : array<string|int, mixed>
Parameters
Return valuesarray<string|int, mixed> —Result array where rows are grouped together by indexes values. set_cookie()Set cookie
set_cookie(DateTimeInterface|int|string, path?: string, domain?: string, secure?: bool, httponly?: bool, samesite?: string, raw?: bool}|Cookie|string $name[, string $value = '' ][, int $expire = 0 ][, string $domain = '' ][, string $path = '/' ][, string $prefix = '' ][, bool|null $secure = null ][, bool|null $httpOnly = null ][, string|null $sameSite = null ]) : void
Accepts seven parameters, or you can submit an associative array in the first parameter containing all the values. ['', 'value', 'expire', '', '', '', '', '', 'name'] Parameters
Tags
get_cookie()Fetch an item from the $_COOKIE array
get_cookie(string $index[, bool $xssClean = false ][, string|null $prefix = '' ]) : array<string, mixed>|string|null
Parameters
TagsReturn valuesarray<string, mixed>|string|nulldelete_cookie()Delete a cookie
delete_cookie(string $name[, string $domain = '' ][, string $path = '/' ][, string $prefix = '' ]) : void
Parameters
Tags
has_cookie()Checks if a cookie exists by name.
has_cookie(string $name[, string|null $value = null ][, string $prefix = '' ]) : bool
Parameters
Return valuesboolnow()Get "now" time
now([non-empty-string|null $timezone = null ]) : int
Returns Time::now()->getTimestamp() based on the timezone parameter or on the app_timezone() setting Parameters
Tags
Return valuesinttimezone_select()Generates a select field of all available timezones
timezone_select([string $class = '' ][, string $default = '' ][, int $what = DateTimeZone::ALL ][, string $country = null ]) : string
Returns a string with the formatted HTML Parameters
Tags
Return valuesstringdirectory_map()Create a Directory Map
directory_map(string $sourceDir[, int $directoryDepth = 0 ][, bool $hidden = false ]) : array<string|int, array<string|int, mixed>|string>
Reads the specified directory and builds an array representation of it. Sub-folders contained with the directory will be mapped as well. Parameters
Return valuesarray<string|int, array<string|int, mixed>|string>directory_mirror()Recursively copies the files and directories of the origin directory into the target directory, i.e. "mirror" its contents.
directory_mirror(string $originDir, string $targetDir[, bool $overwrite = true ]) : void
Parameters
Tags
write_file()Write File
write_file(string $path, string $data[, string $mode = 'wb' ]) : bool
Writes data to the file specified in the path. Creates a new file if non-existent. Parameters
Return valuesbooldelete_files()Delete Files
delete_files(string $path[, bool $delDir = false ][, bool $htdocs = false ][, bool $hidden = false ]) : bool
Deletes all files contained in the supplied directory path. Files must be writable or owned by the system in order to be deleted. If the second parameter is set to true, any directories contained within the supplied base directory will be nuked as well. Parameters
Return valuesboolget_filenames()Get Filenames
get_filenames(string $sourceDir[, bool|null $includePath = false ][, bool $hidden = false ][, bool $includeDir = true ]) : array<int, string>
Reads the specified directory and builds an array containing the filenames. Any sub-folders contained within the specified path are read as well. Parameters
Return valuesarray<int, string>get_dir_file_info()Get Directory File Information
get_dir_file_info(string $sourceDir[, bool $topLevelOnly = true ][, bool $recursion = false ]) : array<string, array{name: string, server_path: string, size: int, date: int, relative_path: string}>
Reads the specified directory and builds an array containing the filenames, filesize, dates, and permissions Any sub-folders contained within the specified path are read as well. Parameters
Return valuesarray<string, array{name: string, server_path: string, size: int, date: int, relative_path: string}>get_file_info()Get File Info
get_file_info(string $file[, array<int, string>|string $returnedValues = ['name', 'server_path', 'size', 'date'] ]) : array{name?: string, server_path?: string, size?: int, date?: int, readable?: bool, writable?: bool, executable?: bool, fileperms?: int}|null
Given a file and path, returns the name, path, size, date modified Second parameter allows you to explicitly declare what information you want returned Options are: name, server_path, size, date, readable, writable, executable, fileperms Returns false if the file cannot be found. Parameters
Return valuesarray{name?: string, server_path?: string, size?: int, date?: int, readable?: bool, writable?: bool, executable?: bool, fileperms?: int}|nullsymbolic_permissions()Symbolic Permissions
symbolic_permissions(int $perms) : string
Takes a numeric value representing a file's permissions and returns standard symbolic notation representing that value Parameters
Return valuesstringoctal_permissions()Octal Permissions
octal_permissions(int $perms) : string
Takes a numeric value representing a file's permissions and returns a three character string representing the file's octal permissions Parameters
Return valuesstringsame_file()Checks if two files both exist and have identical hashes
same_file(string $file1, string $file2) : bool
Parameters
Return valuesbool —Same or not set_realpath()Set Realpath
set_realpath(string $path[, bool $checkExistence = false ]) : string
Parameters
Return valuesstringform_open()Form Declaration
form_open([string $action = '' ][, array<string, scalar|null>|string $attributes = [] ][, array<string, mixed> $hidden = [] ]) : string
Creates the opening portion of the form. Parameters
Return valuesstringform_open_multipart()Form Declaration - Multipart type
form_open_multipart([string $action = '' ][, array<string, scalar|null>|string $attributes = [] ][, array<string, mixed> $hidden = [] ]) : string
Creates the opening portion of the form, but with "multipart/form-data". Parameters
Return valuesstringform_hidden()Hidden Input Field
form_hidden(array<string, mixed>|string $name[, array<string|int, mixed>|string|null $value = '' ][, bool $recursing = false ]) : string
Generates hidden fields. You can pass a simple key/value string or an associative array with multiple values. Parameters
Return valuesstringform_input()Text Input Field. If 'type' is passed in the $type field, it will be used as the input type, for making 'email', 'phone', etc input fields.
form_input([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ][, string $type = 'text' ]) : string
Parameters
Return valuesstringform_password()Password Field
form_password([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Identical to the input function but adds the "password" type Parameters
Return valuesstringform_upload()Upload Field
form_upload([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Identical to the input function but adds the "file" type Parameters
Return valuesstringform_textarea()Textarea field
form_textarea([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_multiselect()Multi-select menu
form_multiselect([array<string, mixed>|string $name = '' ][, array<string|int, array<string|int, string>|string> $options = [] ][, array<string|int, int|string> $selected = [] ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_dropdown()Drop-down Menu
form_dropdown([array<string, mixed>|string $data = '' ][, array<string|int, array<string|int, string>|string>|string $options = [] ][, array<string|int, int|string>|string $selected = [] ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_checkbox()Checkbox Field
form_checkbox([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, bool $checked = false ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_radio()Radio Button
form_radio([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, bool $checked = false ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_submit()Submit Button
form_submit([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_reset()Reset Button
form_reset([array<string, scalar|null>|string $data = '' ][, string $value = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_button()Form Button
form_button([array<string, scalar|null>|string $data = '' ][, string $content = '' ][, array<string, scalar|null>|object|string $extra = '' ]) : string
Parameters
Return valuesstringform_label()Form Label Tag
form_label([string $labelText = '' ][, string $id = '' ][, array<string, scalar|null> $attributes = [] ]) : string
Parameters
Return valuesstringform_datalist()Datalist
form_datalist(string $name, string $value, array<int, string> $options) : string
The Parameters
Return valuesstringform_fieldset()Fieldset Tag
form_fieldset([string $legendText = '' ][, array<string, scalar|null> $attributes = [] ]) : string
Used to produce . To close fieldset use form_fieldset_close()Parameters
Return valuesstringform_fieldset_close()Fieldset Close Tag
form_fieldset_close([string $extra = '' ]) : string
Parameters
Return valuesstringform_close()Form Close Tag
form_close([string $extra = '' ]) : string
Parameters
Return valuesstringset_value()Grabs a value from the POST array for the specified field so you can re-populate an input field or textarea
set_value(string $field[, array<int, string>|scalar|Stringable|null $default = '' ][, bool $htmlEscape = true ]) : array<int, string>|string
Parameters
Return valuesarray<int, string>|stringset_select()Set Select
set_select(string $field[, string $value = '' ][, bool $default = false ]) : string
Let's you set the selected value of a |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |