neogreco / json-request-parser
Simple class to read a json from a request no matter what type of compression/encoding has
Installs: 27
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/neogreco/json-request-parser
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'));