APPNETOS is under active development This website and its documentation are being prepared for public launch. Content and features may change.
Select Theme
Loading

Post

Provides raw and typed access to POST parameters, with controlled mutation of the request parameter container.

Typed parameter access

Typed getters provide explicit conversions and defined fallback values for invalid inputs. Use the POST controller when the parameter must come specifically from the submitted request body.

No direct superglobals

Do not access or modify $_POST directly in application code.

Example

$post = Registry::get(Post::class);
$name = $post->getString('name');

Public API Reference

Core\Post

Class & Registry

Class: Core\Post

Extends: Core\Post\Base

use Core\Post;
use Core\Registry;

$post = Registry::get(Post::class);
Method Description
init():void Initializes the POST parameter controller. No additional initialization is currently required.
get(string $key):mixed Returns the raw POST parameter value for the specified key, or null if the key is missing or its value is null.
getString(string $key, string $default = ''):string Returns a POST parameter converted to a string. Non-scalar values or missing parameters return the specified default.
getInt(string $key, int $default = 0):int Returns a POST parameter validated as an integer, or the specified default if validation fails or the parameter is missing.
getFloat(string $key, float $default = 0.0):float Returns a POST parameter validated as a float, or the specified default if validation fails or the parameter is missing.
getBool(string $key, bool $default = false):bool Returns a POST parameter validated as a boolean, or the specified default if validation fails or the parameter is missing.
getArray(string $key, array $default = []):array Returns an existing array unchanged or wraps a non-null value in an array. Missing or null parameters return the specified default.
getAll():array Returns all POST parameters from the PHP $_POST superglobal.
has(string $key):bool Checks whether a POST parameter exists, including parameters explicitly containing null.
set(string $key, mixed $value):void Sets or overwrites a POST parameter directly in the PHP $_POST superglobal.
remove(string $key):void Removes the specified POST parameter from the PHP $_POST superglobal.
clear():void Removes all POST parameters by resetting the PHP $_POST superglobal to an empty array.

Next Steps

Previous

Get

Explore Get

Next

Cookie

Explore Cookie