PHPackages                             corneltek/pjson - 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. corneltek/pjson

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

corneltek/pjson
===============

1.1.0(10y ago)104.7k11MITPHP

Since Apr 24Pushed 8y ago1 watchersCompare

[ Source](https://github.com/c9s/PJSON)[ Packagist](https://packagist.org/packages/corneltek/pjson)[ RSS](/packages/corneltek-pjson/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (3)Used By (1)

PJSON
=====

[](#pjson)

PJSONEncoder implements a JSON encoder with PHP object to JavaScript object translation support.

You can specify your own encoder for each PHP types:

```
use PJSON\PJSONEncoder;
use PJSON\DateTimeEncoder;
$encoder = new PJSONEncoder;
$encoder->setDateTimeEncoder(new DateTimeEncoder(DateTime::ATOM));
$encoder->setStringEncoder(function($value, $encoder) {
    return '"' . addcslashes($value) . '"';
});
$encoder->setClosureEncoder(function($closure, $encoder) {
    return $encoder->encode($closure(1,2,3));
});
$output = $encoder->encode([ ... PHP Array here ... ]);
```

And you can also encode JavaScript symbols or JavaScript function call in JSON from PHP:

```
$encoder = new PJSONEncoder;
$call = new JsFunctionCall('jQuery', ['#documentId']);
$encoder->encode($call); // outputs 'jQuery("#documentId")'
$encoder->encode(['a' => new JsSymbol('js_var')]); // outputs {"a": js_var}
```

Install
-------

[](#install)

```
composer require corneltek/pjson '*'

```

License
-------

[](#license)

This package is released under MIT License

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity28

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity64

Established project with proven stability

 Bus Factor1

Top contributor holds 90.9% 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

3713d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/3cc34cde233b660869ff329ed8e20df611f75dfb61aab3e30889ac153d3e5e61?d=identicon)[c9s](/maintainers/c9s)

---

Top Contributors

[![c9s](https://avatars.githubusercontent.com/u/50894?v=4)](https://github.com/c9s "c9s (10 commits)")[![hikouki](https://avatars.githubusercontent.com/u/15326035?v=4)](https://github.com/hikouki "hikouki (1 commits)")

### Embed Badge

![Health badge](/badges/corneltek-pjson/health.svg)

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

PHPackages © 2026

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