PHPackages                             yadakhov/okdata - 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. yadakhov/okdata

ActiveLibrary[API Development](/categories/api)

yadakhov/okdata
===============

A wrapper class for the OkData json api specifications.

v1.0(9y ago)124MITPHP

Since Aug 1Pushed 9y ago1 watchersCompare

[ Source](https://github.com/yadakhov/okdata)[ Packagist](https://packagist.org/packages/yadakhov/okdata)[ Docs](https://github.com/yadakhov/okdata)[ RSS](/packages/yadakhov-okdata/feed)WikiDiscussions master Synced today

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

OkData json api response
========================

[](#okdata-json-api-response)

OkData is inspired by the [jsend](https://labs.omniti.com/labs/jsend) api response specifications.

The motivation for the specifications is to have json api responses that looks like:

```
{
    "ok" : true,
    "data" : { "id" : 1 }
}
```

Note to two keys: *ok* and *data* which is why the spec is called OkData.

Required and optional keys for each type:

Ok StatusDescriptionRequired KeysOptional KeystrueAll went well, and (usually) some data was returned.ok, datafalseAn error occurred in processing the request, i.e. an exception was thrownok, errordataExample response types
----------------------

[](#example-response-types)

#### GET /posts.json:

[](#get-postsjson)

```
{
    "ok" : true,
    "data" : {
        "posts" : [
            { "id" : 1, "title" : "A blog post", "body" : "Some useful content" },
            { "id" : 2, "title" : "Another blog post", "body" : "More content" },
        ]
     }
}
```

#### GET /posts/2.json:

[](#get-posts2json)

```
{
    "ok" : true,
    "data" : { "post" : { "id" : 2, "title" : "Another blog post", "body" : "More content" }}
}
```

#### DELETE /posts/2.json:

[](#delete-posts2json)

```
{
    "ok" : true,
    "data" : null
}
```

Required keys:

- ok: Should always be set true
- data: Acts as the wrapper for any data returned by the API call. If the call returns no data (as in the last example), data should be set to null.

### Error

[](#error)

When an API call fails due to an error on the server. For example:

#### GET /posts.json:

[](#get-postsjson-1)

```
{
    "ok" : false,
    "error" : "Unable to communicate with database"
}
```

Required keys:

- ok: Should always be set false.
- error: A meaningful, end-user-readable (or at the least log-worthy) message, explaining what went wrong.

Optional keys:

- data: A generic container for any other information about the error, i.e. the conditions that caused the error, stack traces, etc.

### What's the different between OkData and JSend?

[](#whats-the-different-between-okdata-and-jsend)

OkData uses a boolean status ok. JSend uses three statuses: success, fail, and error. In my experience, we only use success, and error.

The boolean ok status also makes it easier to check. `if (json.ok) { }`

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity8

Limited adoption so far

Community4

Small or concentrated contributor base

Maturity63

Established project with proven stability

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

Unknown

Total

1

Last Release

3619d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/7e2a2bbdfd6287c649a9759274fbd47d769ea78bf09b03ee3dcefe42790a95d4?d=identicon)[yadakhov](/maintainers/yadakhov)

---

Tags

apijsendokdata

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/yadakhov-okdata/health.svg)

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

###  Alternatives

[m165437/laravel-blueprint-docs

API Blueprint Renderer for Laravel

22779.5k](/packages/m165437-laravel-blueprint-docs)

PHPackages © 2026

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