PHP code example of nathanmac / laravel-parser
1. Go to this page and download the library: Download nathanmac/laravel-parser library . Choose the download type require .
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
nathanmac / laravel-parser example snippets
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::payload(); // Auto Detect Type - 'Content Type' HTTP Header
Parse::payload('application/json'); // Specifiy the content type
$parsed = Parse::json('
{
"message": {
"to": "Jack Smith",
"from": "Jane Doe",
"subject": "Hello World",
"body": "Hello, whats going on..."
}
}');
$parsed = Parse::xml('
<?xml version="1.0" encoding="UTF-8"
$parsed = Parse::querystr('to=Jack Smith&from=Jane Doe&subject=Hello World&body=Hello, whats going on...');
$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...";}}');
$parsed = Parse::yaml('
---
message:
to: "Jack Smith"
from: "Jane Doe"
subject: "Hello World"
body: "Hello, whats going on..."
');