1. Go to this page and download the library: Download nathanmac/responder 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/ */
use Nathanmac\Utilities\Responder\Formats\FormatInterface;
/**
* Custom Formatter
*/
class CustomFormatter implements FormatInterface {
/**
* Generate Payload Data
*
* @param array $payload
*
* @return string
*
* @throws ResponderException
*/
public function generate($payload)
{
$payload; // Raw payload array
$output = // Process raw payload array to formatted data
return $output; // return data string
}
}
use Acme\Formatters\CustomFormatter;
$responder = new Responder();
$generated = $responder->generate(['raw' => 'payload', 'data'], new CustomFormatter());
use Acme\Formatters\CustomFormatter;
$responder = new Responder();
$responder->registerFormat('application/x-custom-format', 'Acme\Formatters\CustomFormatter');
$responder->payload('application/x-custom-format');
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.