Skip to content

Carefree traversal of data structures with eventual strict typing

License

Notifications You must be signed in to change notification settings

mrubiosan/loose-schema-navigator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loose Schema Navigator

Build Status Maintainability Test Coverage

Example usage

$data = <<<JSONSTR
{
	"foo":"123",
	"bar":{
		"baz": "true",
		"buzz": "{\"abc\":\"xyz\"}"
	}
}
JSONSTR;

$nav = new Navigator($data);

$nav->foo->int(); // 123
$nav->foo->string(); // "123"
$nav->missingProp->int(); // 0
$nav->missingProp->int(-1); // -1
$nav->bar->baz->int(); // 1
$nav->bar->baz->bool(); // true
$nav->bar->buzz->string(); //  "{"abc":"xyz"}"
$nav->bar->buzz->object(); //  {"abc":"xyz"}
$nav->bar->buzz->array(); //  ["abc" => "xyz"]
$nav->bar->buzz->abc->string(); // "xyz"

About

Carefree traversal of data structures with eventual strict typing

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages