codearchitect/json_response

Take the value user assign/enter to the properties of the class. And return the json formatted response.

dev-master 2020-03-31 12:45 UTC

This package is auto-updated.

Last update: 2024-09-11 21:40:24 UTC


README

#json-responser-package Take the value user assign/enter to the properties of the class. And return the json formatted response.

Installation

composer require codearchitect/json_response

Usage

require_once "vendor/autoload.php";

$test= [
    'name'  =>  'code-architect',
    'task'  =>  'developer',
    'email' =>  'email@xyz.com',
    'tech'  =>  ['php', 'mysql', 'mongodb', 'elastic-search']
];

new \CodeArchitect\ResponseClass\JsonResponse('ok', '', $test);

Param 1 (required)

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

Param 2 (optional)

string - the return message, use empty quote if message is not available

Param 3 (required)

array - data array