phuongdanh/simple-response

This package is used to wrap your response data. It supports for laravel as well

v1.1.1 2022-10-10 07:56 UTC

This package is auto-updated.

Last update: 2025-03-10 13:33:40 UTC


README

Software License Total Downloads

Simple package to handle response properly in your API. This package does not include any dependency.

Install

Via Composer

$ composer require phuongdanh/simple-response

Requirements

The following versions of PHP are supported by this version.

  • PHP 5.6
  • PHP 7.0
  • PHP 7.1
  • PHP 7.2
  • PHP 8.x

How to use it?

// Use namespace 
use SimpleResponse\Response;

// response with default data type based on Accept value in request's header
return Response::default($your_data);

// response as application/json
return Response::json($your_data);

// response as text/xml
return Response::xml($your_data);

License

The MIT License (MIT). Please see License File for more information.