kars/json-response

Returns json format when this package gives value and data properties

1.0.0 2021-10-22 08:15 UTC

This package is not auto-updated.

Last update: 2024-05-18 18:45:10 UTC


README

Returns json format when this package gives value and data properties

Installation

composer require kars/json-response

Use


require_once "vendor/autoload.php";

$test= [
    'name'  =>  'mehmet',
    'email' =>  'mehmetcanak99@gmail.com',
];

new \Kars\JsonResponse\Response('ok', '', $test);

Params (required)

  1. success or ok - 200 http status
  2. unauthorized - 401 http status
  3. exception - 500 http status

Response

{
 "status":"ok",
 "data":
    {
      "name":"mehmet",
      "email":"mehmetcanak99@gmail.com"
    }
}