Skip to content
Simple Format Parser For Laravel 4
Branch: master
Clone or download
nathanmac Update
Project deprecated update README to link to replacement project.
Latest commit 0f5b21d Nov 8, 2014
Type Name Latest commit message Commit time
Failed to load latest commit information.
src Add fix for tab issue YAML Apr 21, 2014
.gitignore Initial commit Apr 3, 2014
.travis.yml Initial commit Apr 3, 2014
LICENSE Initial commit Apr 3, 2014 Update Nov 8, 2014
composer.json Update versions of required packages, to stable versions. Apr 23, 2014
phpunit.xml Initial commit Apr 3, 2014


Build Status Still Maintained

Project no longer maintained see the Parser project for a replacement.

Simple Format Parser For Laravel 4


Begin by installing this package through Composer. Edit your project's composer.json file to require Nathanmac/laravel-parser.

"require": {
	"nathanmac/laravel-parser": "dev-master"

Next, update Composer from the Terminal:

composer update

Once this operation completes, the final step is to add the service provider. Open app/config/app.php, and add a new item to the providers array.

Parsing Functions
	Parse::json($payload);		// JSON > Array
	Parse::xml($payload);		// XML > Array
	Parse::yaml($payload);		// YAML > Array
	Parse::querystr($payload);	// Query String > Array
	Parse::serialize($payload);	// Serialized Object > Array
Parse Input/Payload (PUT/POST)
	Parse::payload();		// Auto Detect Type - 'Content Type' HTTP Header
	Parse::payload('application/json');	// Specifiy the content type
Parse JSON
$parsed = Parse::json('
		"message": {
			"to": "Jack Smith",
			"from": "Jane Doe",
			"subject": "Hello World",
			"body": "Hello, whats going on..."
Parse XML
$parsed = Parse::xml('
			<?xml version="1.0" encoding="UTF-8"?>
					<to>Jack Smith</to>
					<from>Jane Doe</from>
					<subject>Hello World</subject>
					<body>Hello, whats going on...</body>
Parse Query String
$parsed = Parse::querystr('to=Jack Smith&from=Jane Doe&subject=Hello World&body=Hello, whats going on...');
Parse Serialized Object
$parsed = Parse::serialize('a:1:{s:7:"message";a:4:{s:2:"to";s:10:"Jack Smith";s:4:"from";s:8:"Jane Doe";s:7:"subject";s:11:"Hello World";s:4:"body";s:24:"Hello, whats going on...";}}');
Parse YAML
$parsed = Parse::yaml('
				    to: "Jack Smith"
				    from: "Jane Doe"
				    subject: "Hello World"
				    body: "Hello, whats going on..."
Supported Content-Types
application/xml > XML
text/xml > XML

application/json > JSON
application/x-javascript > JSON
text/javascript > JSON
text/x-javascript > JSON
text/x-json > JSON

text/yaml > YAML
text/x-yaml > YAML
application/yaml > YAML
application/x-yaml > YAML

application/vnd.php.serialized > Serialized Object
application/x-www-form-urlencoded' > Query String
You can’t perform that action at this time.