PHPackages                             miwebb/jsend - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. miwebb/jsend

ActiveLibrary[API Development](/categories/api)

miwebb/jsend
============

The PHP JSend implementations

v3.0.1(4y ago)11.1kApache-2.0PHPPHP ^7.3 | ^8

Since Sep 21Pushed 4y ago2 watchersCompare

[ Source](https://github.com/miWebb/JSend)[ Packagist](https://packagist.org/packages/miwebb/jsend)[ Docs](http://webbers.io/php/jsend/)[ RSS](/packages/miwebb-jsend/feed)WikiDiscussions master Synced yesterday

READMEChangelog (9)Dependencies (1)Versions (13)Used By (0)

[![Build Status](https://camo.githubusercontent.com/96ed431b834a5a71aa618de8039f0a5379ad248535ca033ef416cd7603b20ea4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69776562622f4a53656e642f6261646765732f6275696c642e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/miwebb/JSend/build-status/master)[![Code Coverage](https://camo.githubusercontent.com/ee7ea163380fbe03948f4a29a4c41e71757d542ac28fd72327efb286858ffcdb/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69776562622f4a53656e642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/miwebb/JSend/?branch=master)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/39846a1a92e45c487ad202870dd21400a1ae06c6abcd63142be245056f50c130/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f6d69776562622f4a53656e642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/miwebb/JSend/?branch=master)

JSend
=====

[](#jsend)

The PHP [JSend](https://labs.omniti.com/labs/jsend) implementation.

Examples
--------

[](#examples)

### Use

[](#use)

```
require 'vendor/autoload.php';

use miWebb/JSend/JSend;
```

### Create

[](#create)

#### Success

[](#success)

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

#### Fail

[](#fail)

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

#### Error

[](#error)

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

#### Decode

[](#decode)

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

### Output

[](#output)

#### Variable

[](#variable)

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

#### Print

[](#print)

```
$jsend->send();
```

### Methods

[](#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);
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity16

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity65

Established project with proven stability

 Bus Factor1

Top contributor holds 85% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~230 days

Recently: every ~441 days

Total

11

Last Release

1632d ago

Major Versions

v1.2.1 → v2.0.02017-03-13

v2.1.0 → v3.0.02022-01-04

PHP version history (5 changes)v1.0.0PHP &gt;=5.4.0

v1.1.0PHP &gt;=5.6.0

v2.0.0PHP ^7.0

v3.0.0PHP ^7.3 | ^8.0

v3.0.1PHP ^7.3 | ^8

### Community

Maintainers

![](https://www.gravatar.com/avatar/3e37a1078a75a9ff3bb65e76d38bb767cfb36a85c3c79ad4e32600f3a46730b5?d=identicon)[Michael Webbers](/maintainers/Michael%20Webbers)

---

Top Contributors

[![mwebbers](https://avatars.githubusercontent.com/u/5204295?v=4)](https://github.com/mwebbers "mwebbers (34 commits)")[![NielsGrootObbink](https://avatars.githubusercontent.com/u/1335049?v=4)](https://github.com/NielsGrootObbink "NielsGrootObbink (5 commits)")[![Megazijp](https://avatars.githubusercontent.com/u/10260016?v=4)](https://github.com/Megazijp "Megazijp (1 commits)")

---

Tags

jsonapijsend

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/miwebb-jsend/health.svg)

```
[![Health](https://phpackages.com/badges/miwebb-jsend/health.svg)](https://phpackages.com/packages/miwebb-jsend)
```

###  Alternatives

[nathanmac/parser

Simple PHP Parser Utility Library for API Development

2121.0M3](/packages/nathanmac-parser)[nilportugues/jsonapi-bundle

Symfony 2 &amp; 3 JSON API Transformer Package

11446.4k](/packages/nilportugues-jsonapi-bundle)[shalvah/laravel-jsend

Laravel helpers to easily send JSend-compliant responses

62122.1k2](/packages/shalvah-laravel-jsend)[cloudcreativity/json-api-testing

PHPUnit test helpers to check JSON API documents.

141.7M4](/packages/cloudcreativity-json-api-testing)[walle89/swedbank-json

Unofficial API client for the Swedbank's and Sparbanken's mobile apps in Sweden.

782.5k](/packages/walle89-swedbank-json)[wayofdev/laravel-symfony-serializer

📦 Laravel wrapper around Symfony Serializer.

2116.2k](/packages/wayofdev-laravel-symfony-serializer)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
