1. Go to this page and download the library: Download pakman/json-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/ */
...
use pakman\jsp\parsers\Parser;
class HelloWorldParser extends Parser {
public function parse($data): array {
if ($data !== 'Hello') {
throw new ValidationException();
}
return $data . ' world!';
}
}
...
use path\to\HelloWorldParser;
return [
...
'HELLO_WORLD_TYPE' => 'HelloWorldParser::class'
];