kars/json-response

Returns json format when this package gives value and data properties

Installs: 4

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

pkg:composer/kars/json-response

1.0.0 2021-10-22 08:15 UTC

This package is not auto-updated.

Last update: 2025-10-05 01:05:44 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"
    }
}