PHPackages                             zegl/dson-php - 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. zegl/dson-php

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

zegl/dson-php
=============

DSON encoder and decoder for PHP

1.0.2(12y ago)1030[1 issues](https://github.com/Gurrewe/dson-php/issues)GPLv2PHP

Since Jun 8Pushed 12y ago3 watchersCompare

[ Source](https://github.com/Gurrewe/dson-php)[ Packagist](https://packagist.org/packages/zegl/dson-php)[ Docs](https://github.com/Gurrewe/dson-php)[ RSS](/packages/zegl-dson-php/feed)WikiDiscussions master Synced 3w ago

READMEChangelogDependenciesVersions (4)Used By (0)

dson-php
========

[](#dson-php)

DSON encoder/decoder for PHP

[![Doge](https://camo.githubusercontent.com/a36b34171c50834acc0d3c0d983733d7ffc19b3039621782ecd7356fa6d54298/687474703a2f2f646f67656f6e2e6f72672f646f67652e676966)](https://camo.githubusercontent.com/a36b34171c50834acc0d3c0d983733d7ffc19b3039621782ecd7356fa6d54298/687474703a2f2f646f67656f6e2e6f72672f646f67652e676966)

### What is dson-php?

[](#what-is-dson-php)

dson-php is a simple DSON  encoder and decoder. It is a pure PHP-implementatin without any special dependencies.

### How to use?

[](#how-to-use)

#### DSON::encode($in)

[](#dsonencodein)

```
$example = array(
    "many" => "wow",
    "such" => array("foo", "doge", "inu")
);

echo DSON::encode($example);
```

```
such "many" is "wow" ! "such" is so "foo" and "doge" and "inu" many wow

```

#### DSON::decode($str, $assoc = false)

[](#dsondecodestr-assoc--false)

```
$res = DSON::decode('such "many" is "wow" ! "such" is so "foo" and "doge" and "inu" many wow');
```

```
object(stdClass)#1 (2) {
  ["many"]=>
  string(3) "wow"
  ["such"]=>
  array(3) {
    [0]=>
    string(3) "foo"
    [1]=>
    string(4) "doge"
    [2]=>
    string(3) "inu"
  }
}

```

Setting `$assoc = true` will generate the output as an associative array instead, (compare to [http://php.net/json\_decode](http://php.net/json_decode))

```
$res = DSON::decode('such "many" is "wow" ! "such" is so "foo" and "doge" and "inu" many wow', true);
```

```
array(2) {
  ["many"]=>
  string(3) "wow"
  ["such"]=>
  array(3) {
    [0]=>
    string(3) "foo"
    [1]=>
    string(4) "doge"
    [2]=>
    string(3) "inu"
  }
}

```

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity13

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity65

Established project with proven stability

 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

Every ~0 days

Total

3

Last Release

4407d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/47952?v=4)[Gustav Westling](/maintainers/Zegl)[@zegl](https://github.com/zegl)

---

Top Contributors

[![zegl](https://avatars.githubusercontent.com/u/47952?v=4)](https://github.com/zegl "zegl (1 commits)")

---

Tags

jsonDSON

### Embed Badge

![Health badge](/badges/zegl-dson-php/health.svg)

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

###  Alternatives

[justinrainbow/json-schema

A library to validate a json schema.

3.6k334.7M788](/packages/justinrainbow-json-schema)[mtdowling/jmespath.php

Declaratively specify how to extract elements from a JSON document

2.0k504.8M167](/packages/mtdowling-jmespathphp)[jms/serializer

Library for (de-)serializing data of any complexity; supports XML, and JSON.

2.3k141.9M929](/packages/jms-serializer)[jms/serializer-bundle

Allows you to easily serialize, and deserialize data of any complexity

1.8k92.4M680](/packages/jms-serializer-bundle)[colinodell/json5

UTF-8 compatible JSON5 parser for PHP

30525.1M57](/packages/colinodell-json5)[clue/ndjson-react

Streaming newline-delimited JSON (NDJSON) parser and encoder for ReactPHP.

15882.2M31](/packages/clue-ndjson-react)

PHPackages © 2026

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