filipponik / array-analyzer
Array analyzer package
v0.0.1
2022-11-28 14:40 UTC
Requires
- php: ^7.4|^8.0
- ext-json: *
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.13
- phpmd/phpmd: ^2.13
- symfony/var-dumper: ^6.1
This package is auto-updated.
Last update: 2024-11-28 19:09:30 UTC
README
Analyzes array of arrays for researching incoming data as API without documentation and not documented webhooks
Installing
composer require filipponik/array-analyzer --dev
Usage
$arrayOfArrays = [ ['a' => 1, 'b' => 2], ['a' => 2, 'c' => 3], ['a' => 3], ['d' => 'some_string'], ['e' => null], ['f' => 0.01], ]; $analyzer = new \Filipponik\ArrayAnalyzer\Analyzer(); $analyzedCollection = $analyzer->analyze($arrayOfArrays); $result = $analyzedCollection->toArray(); // format result to array $result = $analyzedCollection->toJson(); // format result to JSON $rules = $analyzer->toLaravelRulesStrings(); // possible laravel validation rules in format 'required|string' $rules = $analyzer->toLaravelRulesArrays(); // possible laravel validation rules in format ['required', 'string'] // You may also add prefix for rules (['result' => 'required|array', 'result.*.id' => 'required|integer']) $rules = $analyzer->toLaravelRulesStrings('result');