PHPackages                             razonyang/php-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. razonyang/php-jsend

Abandoned → [razonyang/jsend](/?search=razonyang%2Fjsend)Library[API Development](/categories/api)

razonyang/php-jsend
===================

JSend port for PHP

1.0.0(6y ago)6436BSD-3-ClausePHPPHP ^7.1

Since Aug 20Pushed 6y ago1 watchersCompare

[ Source](https://github.com/razonyang/php-jsend)[ Packagist](https://packagist.org/packages/razonyang/php-jsend)[ RSS](/packages/razonyang-php-jsend/feed)WikiDiscussions master Synced 3d ago

READMEChangelog (1)Dependencies (1)Versions (3)Used By (0)

JSend port for PHP
==================

[](#jsend-port-for-php)

[![Build Status](https://camo.githubusercontent.com/2cbcf9f9bd58ebab871f8913d4916b66392a41d323742b5e59b7ee87bf282d4a/68747470733a2f2f7472617669732d63692e6f72672f72617a6f6e79616e672f7068702d6a73656e642e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/razonyang/php-jsend)[![Scrutinizer Code Quality](https://camo.githubusercontent.com/ba76cef5e26b0207d25260a89cca2f443900fba2073667c9989cfe942f3ba818/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f7068702d6a73656e642f6261646765732f7175616c6974792d73636f72652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/razonyang/php-jsend/?branch=master)[![Code Coverage](https://camo.githubusercontent.com/9af0cf723646b5e5df4ca33702c7987f5af6abfbf41de1864c7f936dc12b1421/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f72617a6f6e79616e672f7068702d6a73656e642f6261646765732f636f7665726167652e706e673f623d6d6173746572)](https://scrutinizer-ci.com/g/razonyang/php-jsend/?branch=master)[![Latest Stable Version](https://camo.githubusercontent.com/6fd4a9d8d55d1e7b3293d9329137383c120dc3b0a989f80a790873dad4130fa9/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f72617a6f6e79616e672f6a73656e642e737667)](https://packagist.org/packages/razonyang/jsend)[![Total Downloads](https://camo.githubusercontent.com/c2870d18bd57427c674e8059bb803ad73ce79faf1c6583aba827c54e17f39514/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f72617a6f6e79616e672f6a73656e642e737667)](https://packagist.org/packages/razonyang/jsend)[![LICENSE](https://camo.githubusercontent.com/7e343cdf98584583409638d4ea51fd5a158d4d47993df95f92a2ac33384fd7b1/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72617a6f6e79616e672f7068702d6a73656e64)](LICENSE)

The package is a PHP's implementation of [JSend](https://github.com/omniti-labs/jsend) specification.

Installation
------------

[](#installation)

```
composer require razonyang/jsend

```

Usage
-----

[](#usage)

```
// generates resposne payload.
$payload = PayloadFactory::success($data); // success payload.
// $payload = PayloadFactory::fail($data); // fail payload.
// $payload = PayloadFactory::error($message, $code, $data); // error payload, the code and data are optional.

// if the factory is not suite for your case, creates payload instance directly.
// $payload = (new Payload())->setStatus($status)->setData($data);

// sends response.
echo $payload->toString($options); // the options the second parameter of json_encode, default to JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES

// the payload can also be formatted like this(same effect as above):
// echo json_encode($payload->toArray(), JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
```

Integration
-----------

[](#integration)

- [Yii2 JSend](https://github.com/razonyang/yii2-jsend) - JSend port for Yii2

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity17

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~0 days

Total

2

Last Release

2460d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/17720932?v=4)[Razon Yang](/maintainers/RazonYang)[@razonyang](https://github.com/razonyang)

---

Top Contributors

[![razonyang](https://avatars.githubusercontent.com/u/17720932?v=4)](https://github.com/razonyang "razonyang (1 commits)")

---

Tags

jsendphp-jsendrest-apirestful-apiREST APIRESTful APIjsend

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[airesvsg/acf-to-rest-api

Exposes Advanced Custom Fields Endpoints in the WordPress REST API

1.4k75.0k](/packages/airesvsg-acf-to-rest-api)[ronasit/laravel-swagger

Provided middleware for generating of swagger-documentation file by run testing of restful API.

179124.9k2](/packages/ronasit-laravel-swagger)[gdebrauwer/laravel-hateoas

Expose the authorization logic of your REST API using HATEOAS links on your Laravel API resources

17389.4k](/packages/gdebrauwer-laravel-hateoas)[obiefy/api-response

Simple Laravel package to return Json responses.

17324.6k](/packages/obiefy-api-response)[shalvah/laravel-jsend

Laravel helpers to easily send JSend-compliant responses

62117.4k2](/packages/shalvah-laravel-jsend)[grok-php/laravel

Seamlessly integrate Grok AI into Laravel applications with an elegant, developer-friendly package. Leverage powerful AI models for chat, automation, and NLP while maintaining Laravel's expressive simplicity.

1633.4k](/packages/grok-php-laravel)

PHPackages © 2026

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