somephp/jsonresponse

Create and send a RESTful JSON response.

Installs: 9

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Forks: 0

Type:project

dev-master 2017-07-31 03:12 UTC

This package is not auto-updated.

Last update: 2024-04-21 12:12:54 UTC


README

Return a RESTFull JSON response. The response body contains 3 properties.

  • data: request results.
  • error: error information. ex.[{code: 555, msg: 'No results Found'}]
  • meta: meta information about the response.

License

MIT - MIT License File: LICENSE

Examples

<?php
$resp = new JSONResponse();
$resp->data[] = 'one';
$resp->data[] = 'two';
$resp->send();

Installation

Composer

composer require somephp/jsonresponse

Contents

ResourceDescription

Contributions

Suggestions and code modifications are welcome. Create a merge request, and tell me what are thinking.