Skip to content
Matthew McNaney edited this page Jun 6, 2013 · 1 revision

To replace usage to $_GET and $_POST, phpWebSite implements the Request class.

To start use of Request, you need to grab the singleton object:

$r = \Request::singleton();

The singleton() method takes Boolean parameter that defaults to false. If you send true, the Request object will be reset. If you are pushing values into the Request object for testing, this will return it to its default state.

State

Once you have your Request object you can test the "state" the site is in. There are three states, get, put and post. A "get" state is a non-post state. You may have $_GET variables, but if $_POST is not set, you are in a get state. A "put" state is a post with an "id" set.