PHPackages                             scon/scon - 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. [Parsing &amp; Serialization](/categories/parsing)
4. /
5. scon/scon

ActiveLibrary[Parsing &amp; Serialization](/categories/parsing)

scon/scon
=========

SCON — Schema-Compact Object Notation: 59-66% smaller than JSON with structural dedup, human-readable, no binary encoding

v1.0.1(5d ago)00MITPHPPHP &gt;=8.1

Since Mar 16Pushed 5d agoCompare

[ Source](https://github.com/QuijoteShin/scon-php)[ Packagist](https://packagist.org/packages/scon/scon)[ Docs](https://github.com/QuijoteShin/scon-php)[ RSS](/packages/scon-scon/feed)WikiDiscussions init Synced today

READMEChangelog (1)DependenciesVersions (2)Used By (0)

scon/scon
=========

[](#sconscon)

**SCON — Schema-Compact Object Notation for PHP**

Human-readable serialization with structural dedup. 59-66% payload reduction, 64% fewer LLM tokens, pure PHP 8.1+.

[![Packagist](https://camo.githubusercontent.com/ea69a9a4f9c88ea312e649cb99f26a508a6361c2147ff3df0eb61d4067d4304b/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73636f6e2f73636f6e2e737667)](https://packagist.org/packages/scon/scon)[![License: MIT](https://camo.githubusercontent.com/7013272bd27ece47364536a221edb554cd69683b68a46fc0ee96881174c4214c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d626c75652e737667)](LICENSE)

Install
-------

[](#install)

```
composer require scon/scon
```

For native performance, the `php-scon` extension (Rust FFI) is available separately.

Quick Start
-----------

[](#quick-start)

```
use Scon\Encoder;
use Scon\Decoder;

$data = ['name' => 'scon', 'version' => 1, 'features' => ['dedup' => true]];

# Encode
$encoder = new Encoder();
$scon = $encoder->encode($data);
// name: scon
// version: 1
// features:
//  dedup: true

# Decode
$decoder = new Decoder();
$parsed = $decoder->decode($scon);
```

Features
--------

[](#features)

- **Structural dedup**: xxHash128 fingerprinting detects repeated subtrees — 59-66% payload reduction on OpenAPI specs
- **Schema subsystem**: Registry with cycle detection, deep merge, dot-notation overrides
- **Validation**: Configurable validation modes
- **Minifier**: Bidirectional minify/expand
- **Pure PHP**: No extensions required, PHP 8.1+

API
---

[](#api)

```
use Scon\{Encoder, Decoder, Minifier, Validator, SchemaRegistry, TreeHash};

# Encode / Decode
$encoder = new Encoder();
$scon = $encoder->encode($data);
$scon = $encoder->withAutoExtract(true)->encode($data); # structural dedup

$decoder = new Decoder();
$data = $decoder->decode($sconString);

# Minify / Expand
$mini = Minifier::minify($sconString);
$expanded = Minifier::expand($mini, indent: 1);

# Validate
$validator = new Validator(mode: 'strict');
$result = $validator->validate($data);
```

Performance
-----------

[](#performance)

Payload reduction on OpenAPI 3.1 spec (71 endpoints):

FormatBytesRatioJSON90,8861.00xSCON26,3470.29xSCON (minified)20,2110.22xLLM token efficiency (cl100k\_base): **64% fewer tokens** — less context window waste for RAG pipelines, tool-use agents, and structured prompts.

For native performance, the `php-scon` extension (Rust FFI) achieves near-parity decode speed with PHP's built-in `json_decode`.

Full methodology: [DOI 10.5281/zenodo.14733092](https://doi.org/10.5281/zenodo.14733092)Benchmarks, optimization log (21 phases), and industrial protocol fixtures: [github.com/QuijoteShin/scon](https://github.com/QuijoteShin/scon)

Also available
--------------

[](#also-available)

- **Rust**: `cargo add scon` — [crates.io/crates/scon](https://crates.io/crates/scon)
- **JavaScript**: `npm install scon-notation` — [npmjs.com/package/scon-notation](https://www.npmjs.com/package/scon-notation)

License
-------

[](#license)

MIT

###  Health Score

38

—

LowBetter than 86% of packages

Maintenance99

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity42

Maturing project, gaining track record

 Bus Factor1

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

Unknown

Total

1

Last Release

5d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/b21d432382ff25be54ea8ec90dcb3d300f206b2481ffe5433e35e9e95ea8ea43?d=identicon)[QuijoteShin](/maintainers/QuijoteShin)

---

Top Contributors

[![QuijoteShin](https://avatars.githubusercontent.com/u/4658549?v=4)](https://github.com/QuijoteShin "QuijoteShin (3 commits)")

---

Tags

schemaparserserializationjson-alternativecompactdedupscon

### Embed Badge

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

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

###  Alternatives

[nikic/php-parser

A PHP parser written in PHP

17.4k887.0M1.6k](/packages/nikic-php-parser)[doctrine/lexer

PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.

11.2k896.2M97](/packages/doctrine-lexer)[erusev/parsedown

Parser for Markdown.

15.0k150.2M630](/packages/erusev-parsedown)[justinrainbow/json-schema

A library to validate a json schema.

3.6k311.5M529](/packages/justinrainbow-json-schema)[league/commonmark

Highly-extensible PHP Markdown parser which fully supports the CommonMark spec and GitHub-Flavored Markdown (GFM)

2.9k393.7M556](/packages/league-commonmark)[opis/closure

A library that can be used to serialize closures (anonymous functions) and arbitrary data.

2.6k228.5M250](/packages/opis-closure)

PHPackages © 2026

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