Http
class Http
Methods
Redirect to a given URL.
If given a valid status code, sets the status and return the previous status code.
Sets the header response header.
Http constructor.
Runs the route
Sends a response and exits script execution.
A convenience method to abort the route and send a response with the given status & message
No description
Details
at line line 25
static
redirect(string $url = '/')
Redirect to a given URL.
Exits execution.
at line line 42
static int
status(int $statusCode = NULL)
If given a valid status code, sets the status and return the previous status code.
If not, returns the current status code.
at line line 69
void
header($headerName, $value, bool $replacePrevious = TRUE)
Sets the header response header.
- Convenience method proxy for the Response class
at line line 79
__construct(string $timezone = 'America/Phoenix')
Http constructor.
at line line 121
Http
get(callable $cb)
Defines a GET callback
at line line 137
Http
post(callable $cb)
Defines a POST callback
at line line 153
Http
put(callable $cb)
Defines a PUT callback
at line line 169
Http
patch(callable $cb)
Defines a PATCH callback
at line line 185
Http
delete(callable $cb)
Defines a DELETE callback
at line line 201
Http
error(callable $cb)
Defines the global exception handler
at line line 217
$this
before(Closure $f)
Set a callback to be run before any route callback is executed.
Called with the Http instance as it's one argument.
at line line 245
$this
after(Closure $f)
Set a callback to be run after any route callback is executed.
Called with the Http instance as it's one argument.
at line line 270
void
exec()
Runs the route
at line line 293
void
send(int $statusCode = 200, string $contentType = 'application/json', string $content = '')
Sends a response and exits script execution.
at line line 331
void
handleError(Exception $e)
This is really an exception handler "error" is just syntactical sugar
at line line 345
void
abort(int $statusCode = 404, string $message = 'Sorry, something went wrong.')
A convenience method to abort the route and send a response with the given status & message