2017 © Pedro Peláez
 

library json

image

phpninjas/json

  • Thursday, October 15, 2015
  • by james.turner.phpninja@gmail.com
  • Repository
  • 1 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Installation

Get Composer, (*1)

curl -sS https://getcomposer.org/installer | php
php composer.phar install

composer.json, (*2)

{
  "require": {
    "phpninjas/json": "v0.1.0"
  }
}

JSON Library

A simple wrapper around the json_encode and json_decode functions that handle errors with exceptions as opposed to using the built-in functions from PHP., (*3)

Encoding

Turn a php variable into a json string (and throw an error during failure)., (*4)

<?php

use phpninjas\JSON\JSON;
use phpninjas\JSON\JsonEncodingException;

try {
    $jsonString = JSON::encode($var);
}catch(JsonEncodingException $e){
    // handle exception
}

Decoding

Turn a JSON string into a php variable (and throw an error during failure)., (*5)

<?php

use phpninjas\JSON\JSON;
use phpninjas\JSON\JsonDecodingException;

try {
    $var = JSON::decode($jsonString);
}catch(JsonDecodingException $e){
    // handle exception
}

The Versions

15/10 2015

dev-master

9999999-dev https://github.com/phpninjas/JSON

  Sources   Download

The Requires

  • php >=5.4

 

The Development Requires

json

15/10 2015

v0.1.0

0.1.0.0 https://github.com/phpninjas/JSON

  Sources   Download

The Requires

  • php >=5.4

 

The Development Requires

json