Skip to content

PHP Simple Response, XML, JSON,... auto response with accept in request's header

Notifications You must be signed in to change notification settings

phuongdanh/simple-response

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

simple-response

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.

About

PHP Simple Response, XML, JSON,... auto response with accept in request's header

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages