diff --git a/Requests.md b/Requests.md new file mode 100644 index 0000000..9b62b13 --- /dev/null +++ b/Requests.md @@ -0,0 +1,30 @@ +Flight encapsulates the HTTP request into a single object, which can be accessed by doing: + + $request = Flight::request(); + +The request object provides the following properties: + + url - The URL being requested + base - The parent subdirectory of the URL + method - The request method (GET, POST, PUT, DELETE) + referrer - The referrer URL + ip - IP address of the client + ajax - Whether the request is an AJAX request + scheme - The server protocol (http, https) + user_agent - Browser information + body - Raw data from the request body + type - The content type + length - The content length + query - Query string parameters + data - Post parameters + cookies - Cookie parameters + files - Uploaded files + +You can access the `query`, `data`, `cookies`, and `files` properties as arrays or objects. +So, to get a query string parameter, you can do: + + $id = Flight::request()->query['id']; + +Or you can do: + + $id = Flight::request()->query->id; \ No newline at end of file