2017 © Pedro Peláez
 

library json-object

Json object to work better with json

image

albo-vieira/json-object

Json object to work better with json

  • Friday, July 1, 2016
  • by AlboVieira
  • Repository
  • 1 Watchers
  • 0 Stars
  • 46 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 2 Versions
  • 10 % Grown

The README.md

json-object

Json object to work better with json ., (*1)

Instalation

composer require albo-vieira/json-object:dev-master && install

Usage


$json = new Json(); /** Creating a Json Object without data, just keys */ $obj = $json->create('id','status','data','message','token'); /** Creating a Json Object with data, keys and values from a string json */ $jsonStr= '{ "registration_ids": ["54654564645"], "notification": { "title":"This is a title. title", "text":"here is a message. message" } }' ; $objFromJson = (new Json())->createFromJson($jsonStr); /** Creating a Json Object with data, keys and values from an array */ $objFromArray = (new Json())->createFromArray([ 'id' => 1, 'status' => 'on', 'data' => [1,2], 'message' => 'A message', 'token' => 'Token for validate' ]); /** The keys of the array became attributes , then you can change the values like you want */ $objFromArray->status = 'off'; $objFromArray->token = 'New Token'; /** Render Json */ $json->render(); /** Convert obj in array */ $json->toArray();

The Versions

01/07 2016

dev-master

9999999-dev

Json object to work better with json

  Sources   Download

MIT

by Albo Vieira

01/07 2016

dev-dev

dev-dev

Json object to work better with json

  Sources   Download

MIT

by Albo Vieira