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(7y ago)93217.0k↑28.5%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 1mo 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 89% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity47

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

2895d ago

Major Versions

v2.0.1 → v3.02018-06-14

### Community

Maintainers

![](https://www.gravatar.com/avatar/698cdb9538d0c24620186aee6466db1197f15f96d5c353af2b4167223b92510e?d=identicon)[eastwest](/maintainers/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

[rmrevin/yii2-comments

Comments module for Yii2

5130.8k](/packages/rmrevin-yii2-comments)[easyswoole/verifycode

21102.4k4](/packages/easyswoole-verifycode)[svanderburg/composer2nix

Generate Nix expressions to build PHP composer packages

925.5k](/packages/svanderburg-composer2nix)[jolicode/seo-override

Override your seo markup on the fly

1462.4k](/packages/jolicode-seo-override)[docomoinnovations/cloud_orchestrator

Cloud orchestrator distribution by DOCOMO Innovations, Inc.

108.4k](/packages/docomoinnovations-cloud-orchestrator)

PHPackages © 2026

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