2017 © Pedro Peláez
 

library php-json-encode

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

image

im-denisenko/php-json-encode

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

  • Sunday, January 25, 2015
  • by im-denisenko
  • Repository
  • 0 Watchers
  • 1 Stars
  • 108 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Future\Json

Build Status, (*1)

Provides features, added to json_encode since version 5.3.0, for version 5.3.0., (*2)

Reference

  • >=5.5.0 Third parameter $depth allow let you set the maximum depth., (*3)

  • >=5.4.0 Option JSON_PRETTY_PRINT let use whitespace in returned data to format it., (*4)

  • >=5.4.0 Option JSON_UNESCAPED_SLASHES let don't escape /., (*5)

  • >=5.4.0 Option JSON_UNESCAPED_UNICODE let encode multibyte Unicode characters literally (default is to escape as \uXXXX)., (*6)

  • >=5.3.3 Option JSON_NUMERIC_CHECK let you encode numeric strings as numbers., (*7)

Usage

$data = array('foo' => 'bar');
echo Future\Json::encode($data, JSON_PRETTY_PRINT);
echo Future\Json::encode($data, JSON_NUMERIC_CHECK);
echo Future\Json::encode($data, JSON_UNESCAPED_SLASHES);
echo Future\Json::encode($data, JSON_UNESCAPED_UNICODE);
echo Future\Json::encode($data, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
echo Future\Json::encode($data, null, 4);

Shortcut

If you dont like Namespace\Classname::staticMethod call, you can use shortcuts., (*8)

future_json_encode($data, JSON_UNESCAPED_UNICODE, 10);

Testing

If current version PHP allow to use features described above, then encoder will pass all arguments to native function instead., (*9)

Directory tests/ contains json files that were generated using native function in PHP 5.5.6., (*10)

You can run the unit tests just to be sure that you will get exactly the same result regardless of your system:, (*11)

$ composer install --dev
$ vendor/bin/phpunit tests/

The Versions

25/01 2015

dev-master

9999999-dev

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Igor Denisenko

json json_encode

25/01 2015

0.0.3

0.0.3.0

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Igor Denisenko

json json_encode

25/01 2015

0.0.1

0.0.1.0

Provides features, added to json_encode since version 5.3.0, for version 5.3.0.

  Sources   Download

MIT

The Requires

  • php >=5.3.0

 

The Development Requires

by Igor Denisenko

json json_encode