PHPackages                             eastwest/json - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. eastwest/json

AbandonedArchivedLibrary[Utility &amp; Helpers](/categories/utility)

eastwest/json
=============

Wrap JSON encoding/decoding errors in exception

v3.0.1(8y ago)93231.9k—10%59MITPHPPHP &gt;=7.0

Since May 10Pushed 2y ago2 watchersCompare

[ Source](https://github.com/jannejava/json)[ Packagist](https://packagist.org/packages/eastwest/json)[ RSS](/packages/eastwest-json/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (2)Dependencies (1)Versions (6)Used By (9)

Wrap JSON encoding/decoding errors in exception
===============================================

[](#wrap-json-encodingdecoding-errors-in-exception)

Catch `json_encode()` and `json_decode()` errors without executing `json_last_error()`. In PHP 7.3 these functions will [throw an exception](https://laravel-news.com/php-7-3-json-error-handling).

```
use Eastwest\Json\Json;
use Eastwest\Json\JsonException;

try {
    $json = Json::encode(['key' => 'value']);
} catch (JsonException $e) {
    // code and message will match json_last_error() values:
    // @link http://php.net/manual/en/function.json-last-error.php#refsect1-function.json-last-error-returnvalues
    echo $e->getMessage();
    echo $e->getCode();
}
```

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

[](#installation)

You'll have to follow a couple of simple steps to install this package.

### Downloading

[](#downloading)

Via [composer](http://getcomposer.org):

```
$ composer require eastwest/json:^3.0
```

Or add the package to your development dependencies in `composer.json` and run `composer update eastwest/json` to download the package:

```
{
    "require": {
        "eastwest/json": "^3.0"
    }
}
```

*If you need a way to deploy files or manage your Laravel Forge servers. Take a look at [GitFTP-Deploy](https://gitftp-deploy.com) or [F-Bar](https://laravel-forge-menubar.com)*

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity48

Moderate usage in the ecosystem

Community22

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor1

Top contributor holds 89.7% 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 ~11 days

Total

4

Last Release

2986d ago

Major Versions

v2.0.1 → v3.02018-06-14

### Community

Maintainers

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

---

Top Contributors

[![jannejava](https://avatars.githubusercontent.com/u/543616?v=4)](https://github.com/jannejava "jannejava (26 commits)")[![jarektkaczyk](https://avatars.githubusercontent.com/u/6928818?v=4)](https://github.com/jarektkaczyk "jarektkaczyk (2 commits)")[![vanodevium](https://avatars.githubusercontent.com/u/16780069?v=4)](https://github.com/vanodevium "vanodevium (1 commits)")

---

Tags

jsonlaravel

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/eastwest-json/health.svg)

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

###  Alternatives

[brumann/polyfill-unserialize

Backports unserialize options introduced in PHP 7.0 to older PHP versions.

333.8M1](/packages/brumann-polyfill-unserialize)[nxp/russian-porter-stemmer

Russian porter stemmer

4592.1k1](/packages/nxp-russian-porter-stemmer)[cheprasov/php-parallel

The class allows you to run multiple operations parallel in different processes and send results to the main process. Useful if you need to run multiple independent operations simultaneously, instead of sequential execution, or if you run several independent queries, for example, queries to different data bases

1712.6k5](/packages/cheprasov-php-parallel)

PHPackages © 2026

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