Overview
Leaf tries as much as possible to use raw PHP written from scratch, so, instead of using PSR-7 like most frameworks do, Leaf has written predefined request methods. The request section basically deals with requests made to the app, so far, there are only two functions chained to the Request class. To use the request object, you simply need to pass $request into your $route like this.
Including Request
To include the Request object in a route, use this:
$request
to the Request
class, and we pass it into the route with use()
.
Request Methods
getParam()
getParam is a method built for APIs, but can be used in a normal web app/website. It takes in one parameter: the name of the param passed into the app through the request
It works just like how $_POST['key']
does
getBody()
getBody() returns the key => value pairs of all the request data
Next Steps
Simple RoutingResponse
Simple Authentication
Database Config