kmvan / response
Http response.
0.0.1
2022-04-24 11:23 UTC
Requires
- php: >=8.1.0
Suggests
- kmvan/status-code: HTTP Status code
This package is auto-updated.
Last update: 2025-03-24 18:03:19 UTC
README
INSTALL
composer require kmvan/response
REQUIRED
- PHP 8.1 or later
USAGE
<?php use Kmvan\Response; $res = new Response(); // 404 not found $res->setStatus(404) ->end(); // exit // 201 created $res->setStatus(201) ->setData([ // output json 'name' => 'Jack', ]) ->end(); // exit
RECOMMEND
Good experience with composer require kmvan/status-code
library.
<?php use Kmvan\StatusCode; use Kmvan\Response; $req = new Response(); $req->setStatus(StatusCode::OK) // http status code 200 ->end();