PHPackages                             khalyomede/php-jur - 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. khalyomede/php-jur

ActiveLibrary

khalyomede/php-jur
==================

PHP class that follows the JSON Uniform Response standard

v2.0.0(7y ago)0801MITPHPPHP &gt;=7.2.0

Since Jul 29Pushed 7y ago1 watchersCompare

[ Source](https://github.com/khalyomede/php-jur)[ Packagist](https://packagist.org/packages/khalyomede/php-jur)[ RSS](/packages/khalyomede-php-jur/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependencies (1)Versions (8)Used By (1)

php-jur
=======

[](#php-jur)

Json Uniform Response for PHP.

[![Packagist](https://camo.githubusercontent.com/bfa589be5e0eeab95c44e9a59af5ffb030aab98d248420d6b0e3901159f960ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b68616c796f6d6564652f7068702d6a75722e737667)](https://camo.githubusercontent.com/bfa589be5e0eeab95c44e9a59af5ffb030aab98d248420d6b0e3901159f960ee/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f6b68616c796f6d6564652f7068702d6a75722e737667)[![PHP from Packagist](https://camo.githubusercontent.com/ea36ace2abfc5d0fe07b271deb9665d6388f006b3bfacd4dcf87a3d744a41a1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b68616c796f6d6564652f7068702d6a75722e737667)](https://camo.githubusercontent.com/ea36ace2abfc5d0fe07b271deb9665d6388f006b3bfacd4dcf87a3d744a41a1e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f6b68616c796f6d6564652f7068702d6a75722e737667)[![Packagist](https://camo.githubusercontent.com/4ab9fc988fcad582372d0874f55e0f5a488f6db762baa2a2b0caf4f15223d9ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b68616c796f6d6564652f7068702d6a75722e737667)](https://camo.githubusercontent.com/4ab9fc988fcad582372d0874f55e0f5a488f6db762baa2a2b0caf4f15223d9ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f6b68616c796f6d6564652f7068702d6a75722e737667)

Summary
-------

[](#summary)

- [Standard](#standard)
- [Installation](#installation)
- [Examples](#examples)

For a support for PHP 5.X, please use the version 1.\* of this library. Note the version 1.\* is no longer maintained.

Standard
--------

[](#standard)

Json Uniform Response (JUR) is a way to deliver JSON response in a consistant manner. To learn more, go to the [official documentation](https://github.com/khalyomede/jur).

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

[](#installation)

In your root project folder, type the following command:

```
composer require khalyomede/php-jur:2.*
```

Examples
--------

[](#examples)

- [Get a response as a JSON string](#get-a-json-response)
- [Get a response as an array](#get-a-response-as-an-array)
- [Get a response as an object](#get-a-response-as-an-array)
- [Attach a message to the response](#attach-a-message-to-the-response)
- [Set custom timestamps](#set-custom-timestamps)

### Get a response as a JSON string

[](#get-a-response-as-a-json-string)

```
require(__DIR__ . '/../vendor/autoload.php');

$response = jur()
  ->request('get')
  ->data([
    ['id' => 1, 'name' => 'New in PHP 7.2', 'author' => 'Carlo Daniele'],
    ['id' => 2, 'name' => 'Help for new PHP project', 'author' => 'Khalyomede']
  ])
  ->toJson();

echo $response;
```

```
{"message":null,"request":"get","data":[{"id":1,"name":"New in PHP 7.2","author":"Carlo Daniele"},{"id":2,"name":"Help for new PHP project","author":"Khalyomede"}],"debug":{"elapsed":27,"issued_at":1529617930807795,"resolved_at":1529617930807822}}
```

### Get a response as an array

[](#get-a-response-as-an-array)

```
require(__DIR__ . '/../vendor/autoload.php');

$response = jur()
  ->request('get')
  ->data([
    ['id' => 1, 'name' => 'New in PHP 7.2', 'author' => 'Carlo Daniele'],
    ['id' => 2, 'name' => 'Help for new PHP project', 'author' => 'Khalyomede']
  ])
  ->toArray();

print_r($response);
```

```
Array
(
    [message] =>
    [request] => get
    [data] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => New in PHP 7.2
                    [author] => Carlo Daniele
                )

            [1] => Array
                (
                    [id] => 2
                    [name] => Help for new PHP project
                    [author] => Khalyomede
                )

        )

    [debug] => Array
        (
            [elapsed] => 24
            [issued_at] => 1.5296179859844E+15
            [resolved_at] => 1.5296179859845E+15
        )

)
```

### Get a response as an object

[](#get-a-response-as-an-object)

```
require(__DIR__ . '/../vendor/autoload.php');

$response = jur()
  ->request('get')
  ->data([
    ['id' => 1, 'name' => 'New in PHP 7.2', 'author' => 'Carlo Daniele'],
    ['id' => 2, 'name' => 'Help for new PHP project', 'author' => 'Khalyomede']
  ])
  ->toObject();

print_r($response);
```

```
stdClass Object
(
    [message] =>
    [request] => get
    [data] => Array
        (
            [0] => Array
                (
                    [id] => 1
                    [name] => New in PHP 7.2
                    [author] => Carlo Daniele
                )

            [1] => Array
                (
                    [id] => 2
                    [name] => Help for new PHP project
                    [author] => Khalyomede
                )

        )

    [debug] => stdClass Object
        (
            [elapsed] => 27
            [issued_at] => 1.5296180326839E+15
            [resolved_at] => 1.5296180326839E+15
        )

)
```

### Attach a message to the response

[](#attach-a-message-to-the-response)

```
require(__DIR__ . '/../vendor/autoload.php');

$response = jur()
  ->request('post')
  ->message('Task saved.')
  ->data([
    'id' => 42
  ])
  ->toJson();

echo $response;
```

```
{"message":"Task saved.","request":"post","data":{"id":42},"debug":{"elapsed":26,"issued_at":1529618086871988,"resolved_at":1529618086872014}}
```

### Set custom timestamps

[](#set-custom-timestamps)

```
require(__DIR__ . '/../vendor/autoload.php');

$response = jur();

// ...

$response->issued();

// ...

$response->request('post')
    ->message('Task saved')
    ->data([
        'id' => 42
    ]);

// ...

$response->resolved();

// ...

echo $response->toJson();
```

```
{"message":"Task saved","request":"post","data":{"id":42},"debug":{"elapsed":10,"issued_at":1529618141842064,"resolved_at":1529618141842074}}

```

###  Health Score

28

—

LowBetter than 54% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 57.1% 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 ~54 days

Recently: every ~82 days

Total

7

Last Release

2880d ago

Major Versions

v0.1.1 → v1.0.02017-07-30

v1.0.3 → v2.0.02018-06-21

PHP version history (2 changes)v0.1.0PHP &gt;=5.3.0

v2.0.0PHP &gt;=7.2.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/15908747?v=4)[Anwar](/maintainers/khalyomede)[@khalyomede](https://github.com/khalyomede)

---

Top Contributors

[![port-adhoc2](https://avatars.githubusercontent.com/u/32571986?v=4)](https://github.com/port-adhoc2 "port-adhoc2 (4 commits)")[![khalyomede](https://avatars.githubusercontent.com/u/15908747?v=4)](https://github.com/khalyomede "khalyomede (3 commits)")

### Embed Badge

![Health badge](/badges/khalyomede-php-jur/health.svg)

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

PHPackages © 2026

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