neogreco / json-request-parser
Simple class to read a json from a request no matter what type of compression/encoding has
v1.0.12
2021-11-09 14:14 UTC
Requires
- php: ^7.3|^8.0
- monolog/monolog: ^2.3
- vdechenaux/brotli: ^1.0
Requires (Dev)
- orchestra/testbench: ^3.8
README
From a Request content string and the header content encoding string, decompress and decode the info returning a Json String or null if cannot find a proper method.
Installation
This project using composer.
$ composer require neogreco/json-request-parser
Usage
Parse a json data
<?php use JSON\tools\JSONRequestParser; class SomeController extends Controller { public function index(Request $request) { try { $json = JSONRequestParser::extractJsonFrom($request->getContent(), $request->header('Content-Encoding'));