2017 © Pedro Peláez
 

library json-response

A simple class that returns a properly formatted json response with HTTP status

image

devscreencast/json-response

A simple class that returns a properly formatted json response with HTTP status

  • Saturday, April 22, 2017
  • by terdia
  • Repository
  • 0 Watchers
  • 1 Stars
  • 11 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 22 % Grown

The README.md

json-response

A simple class that returns a properly formatted json response with HTTP status, (*1)

Installation

composer require devscreencast/json-response, (*2)

Usage

<?php
require_once __DIR__ ."/vendor/autoload.php";

use Devscreencast\ResponseClass\JsonResponse;

$student = array(
    'name' => 'John Doe',
    'course' => 'Software Engineering',
    'level' => '200',
    'collections' => ['books' => 'Intro to UML', 'music' => 'rap']
);

new JsonResponse('ok', '', $student);

Param 1 (Required)

  1. success or ok - 200 http status
  2. unauthorized - 401 http status
  3. exception - 500 http status (internal server error)

Param 2 (Optional)

string - the return message, use empty quote if not available, (*3)

Param 3 (Optional)

Array - Array of Data, (*4)

The Versions

22/04 2017

dev-master

9999999-dev

A simple class that returns a properly formatted json response with HTTP status

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php json response api response class

22/04 2017

1.1.1

1.1.1.0

A simple class that returns a properly formatted json response with HTTP status

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php json response api response class

22/04 2017

1.1.0

1.1.0.0

A simple class that returns a properly formatted json response with HTTP status

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

php json response api response class