2017 © Pedro Peláez
 

library rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

image

kunststube/rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

  • Tuesday, February 10, 2015
  • by deceze
  • Repository
  • 2 Watchers
  • 21 Stars
  • 8,879 Installations
  • PHP
  • 3 Dependents
  • 1 Suggesters
  • 0 Forks
  • 1 Open issues
  • 4 Versions
  • 20 % Grown

The README.md

Kunststube\Rison encoder and decoder for PHP

Rison is a compact data format optimized for URIs, a slight variation of JSON., (*1)

JSON:, (*2)

{"a":0,"b":"foo","c":"23skidoo"}

URI-encoded JSON:, (*3)

%7B%22a%22:0,%22b%22%3A%22foo%22%2C%22c%22%3A%2223skidoo%22%7D

Rison:, (*4)

(a:0,b:foo,c:'23skidoo')

URI-encoded Rison:, (*5)

(a:0,b:foo,c:'23skidoo')

See http://mjtemplate.org/examples/rison.html for more information and other implementations., (*6)

Usage

Procedural/convenience wrapper

require_once 'Rison/rison_functions.php';

$data = array('foo', 'bar' => array('baz'));

// encoding
$rison = Kunststube\Rison\rison_encode($data);
var_dump($rison);

// decoding
$data = Kunststube\Rison\rison_decode($rison);
var_dump($data);

Object oriented

require_once 'Rison/RisonEncoder.php';
require_once 'Rison/RisonDecoder.php';

use Kunststube\Rison;

$data = array('foo', 'bar' => array('baz'));

// encoding
try {
    $encoder = new Rison\RisonEncoder($data);
    $rison   = $encoder->encode();
    var_dump($rison);
} catch (InvalidArgumentException $e) {
    echo $e->getMessage();
}

// decoding
try {
    $decoder = new Rison\RisonDecoder($rison);
    $data    = $decoder->decode();
    var_dump($data);
} catch (Rison\RisonParseErrorException $e) {
    echo $e->getMessage(), ' in string: ', $e->getRison();
} catch (InvalidArgumentException $e) {
    echo $e->getMessage();
}

PSR-0

The repository is organized so its contents can be dumped into a folder Kunststube/Rison/ and the naming be PSR-0 compliant., (*7)

Information

Version: 0.92
Author: David Zentgraf
Contact: rison@kunststube.net
License: Public Domain, (*8)

The Versions

10/02 2015

dev-master

9999999-dev https://github.com/deceze/Kunststube-Rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

encode decode rison

10/02 2015

0.92.1

0.92.1.0 https://github.com/deceze/Kunststube-Rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

encode decode rison

13/11 2012

0.92

0.92.0.0 https://github.com/deceze/Kunststube-Rison

A PHP encoder and decoder for Rison, the compact JSON-like data format optimized for URIs.

  Sources   Download

The Requires

  • php >=5.3.0

 

encode decode rison

13/11 2012

0.91

0.91.0.0 https://github.com/deceze/Kunststube-Rison

A Rison encoder and decoder for PHP.

  Sources   Download

The Requires

  • php >=5.4.0

 

encode decode rison