vajexal / js-object-parser
JS object parser
0.1.3
2021-05-26 16:24 UTC
Requires
- php: ^8.0
- symfony/polyfill-mbstring: ^1.22
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.0
- phpunit/phpunit: ^9.5
- symfony/var-dumper: ^5.2
- vimeo/psalm: ^4.7
This package is auto-updated.
Last update: 2025-03-29 01:12:26 UTC
README
JS object parser
Installation
composer require vajexal/js-object-parser
Usage
<?php declare(strict_types=1); use Vajexal\JsObjectParser\JsObjectParser; require_once 'vendor/autoload.php'; $jsObjectParser = new JsObjectParser(); var_dump( $jsObjectParser->parse('true'), // bool(true) $jsObjectParser->parse('123'), // int(123) $jsObjectParser->parse("'foo'"), // string(3) "foo" $jsObjectParser->parse('[1, 2]'), // array(2) { [0] => int(1) [1] => int(2) } $jsObjectParser->parse("{foo: 'bar'}") // array(1) { ["foo"] => string(3) "bar" } );