Nathanmac\Utilities\Parser\Parser::payload PHP Method

payload() public method

Override the format by providing a content type.
public payload ( string $format = '' ) : array
$format string
return array
    public function payload($format = '')
    {
        $class = $this->getFormatClass($format);
        return $this->parse($this->getPayload(), new $class());
    }

Usage Example

<?php

require "../vendor/autoload.php";
use Nathanmac\Utilities\Parser\Parser;
$parser = new Parser();
echo "<h1>POST/PUT Payload AutoDetect - Example</h1>";
$parsed = $parser->payload('application/xml');
echo "<pre>";
print_r($parsed);
echo "</pre>";