2017 © Pedro Peláez
 

library jsend

The PHP JSend implementations

image

miwebb/jsend

The PHP JSend implementations

  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 11 Versions
  • 61 % Grown

The README.md

Build Status Code Coverage Scrutinizer Code Quality, (*1)

JSend

The PHP JSend implementation., (*2)

Examples

Use

require 'vendor/autoload.php';

use miWebb/JSend/JSend;

Create

Success

$jsend = new JSend('success', $data);
$jsend = new JSend(JSend::SUCCESS, $data);
$jsend = JSend::success($data);

Fail

$jsend = new JSend('fail', $data);
$jsend = new JSend(JSend::FAIL, $data);
$jsend = JSend::fail($data);

Error

$jsend = new JSend('error', $data, $message, $code);
$jsend = new JSend(JSend::ERROR, $data, $message, $code);
$jsend = JSend::error($message, $code, $data);

Decode

try {
    $jsend = JSend::decode($json);
} catch(UnexpectedValueException $e) {
    // Error message
}

Output

Variable

$json = $jsend->decode();
$json = (string) $jsend;

Print

$jsend->send();

Methods

$jsend = new JSend(JSend::SUCCESS, $data);
$jsend->__toString();
$jsend->toArray();
$jsend->encode();
$jsend->isSuccess();
$jsend->isFail();
$jsend->isError();
$jsend->getStatus();
$jsend->setStatus($status);
$jsend->getData();
$jsend->setData($data = null);
$jsend->getMessage();
$jsend->setMessage($message = null);
$jsend->getCode();
$jsend->setCode($code = null);
$jsend->send();
JSend::success($data = null);
JSend::fail($data);
JSend::error($message, $code = null, $data = null);
JSend::decode($input);

The Versions

23/02 2018

dev-master

9999999-dev http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0

 

The Development Requires

api json jsend

23/02 2018

v2.1.0

2.1.0.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0

 

The Development Requires

api json jsend

23/01 2018

dev-develop

dev-develop http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0

 

The Development Requires

api json jsend

13/03 2017

v2.0.0

2.0.0.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php ^7.0

 

The Development Requires

api json jsend

13/03 2017

v1.2.1

1.2.1.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

13/03 2017

v1.2.0

1.2.0.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

18/08 2016

v1.1.3

1.1.3.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

18/08 2016

v1.1.2

1.1.2.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

18/08 2016

v1.1.1

1.1.1.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

18/12 2015

v1.1.0

1.1.0.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.6.0

 

The Development Requires

api json jsend

21/09 2015

v1.0.0

1.0.0.0 http://webbers.io/php/jsend/

The PHP JSend implementations

  Sources   Download

Apache-2.0

The Requires

  • php >=5.4.0

 

The Development Requires

api json jsend