https://github.com/code-architect/json-responser-package
https://github.com/code-architect/json-responser-package
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/code-architect/json-responser-package
- Owner: code-architect
- License: mit
- Created: 2020-03-31T09:48:52.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-04-11T11:05:46.000Z (almost 6 years ago)
- Last Synced: 2024-12-28T13:33:55.671Z (about 1 year ago)
- Language: PHP
- Size: 5.86 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```php
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