2017 © Pedro Peláez
 

library dson-php

DSON encoder and decoder for PHP

image

zegl/dson-php

DSON encoder and decoder for PHP

  • Sunday, June 8, 2014
  • by Zegl
  • Repository
  • 3 Watchers
  • 8 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 1 Suggesters
  • 0 Forks
  • 0 Open issues
  • 4 Versions
  • 0 % Grown

The README.md

dson-php

DSON encoder/decoder for PHP, (*1)

Doge, (*2)

What is dson-php?

dson-php is a simple DSON http://dogeon.org encoder and decoder. It is a pure PHP-implementatin without any special dependencies., (*3)

How to use?

DSON::encode($in)

$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)

$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), (*4)

$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"
  }
}

The Versions

08/06 2014

dev-master

9999999-dev https://github.com/Gurrewe/dson-php

DSON encoder and decoder for PHP

  Sources   Download

GPLv2

json dson

08/06 2014

1.0.2

1.0.2.0 https://github.com/Gurrewe/dson-php

DSON encoder and decoder for PHP

  Sources   Download

GPLv2

json dson

08/06 2014

1.0.1

1.0.1.0 https://github.com/Gurrewe/dson-php

DSON encoder and decoder for PHP

  Sources   Download

GPLv2

json dson

08/06 2014

1.0.0

1.0.0.0 https://github.com/Gurrewe/dson-php

DSON encoder and decoder for PHP

  Sources   Download

GPLv2

json dson