Skip to content
Greg Bowler edited this page Jun 23, 2018 · 14 revisions

The Input repository is separately maintained at https://github.com/PhpGt/Input

By default, PHP exposes all user input in the superglobal variables $_GET, $_POST and $_FILES, which are readable and writable by any code, including third party libraries.

All superglobals are protected within WebEngine, and instead user input is encapsulated within the Input object, which is available as the input property of your application's Logic classes.

Reading an input value from within a Logic class

It doesn't matter what HTTP verb (GET, POST, PUT, DELETE, etc.) is used for the request as input is accessed in the same way for all verbs.

public function getUserInput() {
// Read the "telephone" parameter from the query string or post body:
	$telephone = $this->input->get("telephone");

// Read the "name" parameter, supplying a default if input is empty:
	$name = $this->input->get("name") ?? "Anon";
}
Clone this wiki locally