cline / json
Memory-efficient pull parser for large JSON sources in Laravel and PHP applications.
Requires
- php: ^8.5.0
- guzzlehttp/guzzle: ^7.10
- illuminate/http: ^10.0 || ^11.0 || ^12.0 || ^13.0
- psr/http-message: ^2.0
Requires (Dev)
- cline/bench: ^1.0.1
- cline/coding-standard: ^2.0.1
- mockery/mockery: ^1.6
- orchestra/testbench: ^10.8
- pestphp/pest: ^4.0
- phpstan/phpstan: ^2.1
- rector/rector: ^2.0
- symfony/var-dumper: ^7.4.0 || ^8.0
README
json
Memory-efficient pull parser for large JSON sources in Laravel and PHP applications.
Requirements
- PHP 8.5+
Installation
composer require cline/json
Quick Example
use Cline\Json\JsonParser; $records = JsonParser::parse(storage_path('app/records.json')) ->pointer('/data') ->toArray();
Documentation
- Consumer guide: USAGE.md
- Benchmarking guide: BENCHMARK.md
Supported API Surface
The stable, consumer-facing API is centered on:
Cline\Json\JsonParser- the
parseJson()helper - string-based pointer selection through
pointer(),pointers(),lazyPointer(), andlazyPointers() - decoder customization through
Cline\Json\Decoders\Decoder,JsonDecoder, andSimdjsonDecoder - package exceptions that implement
Cline\Json\Exceptions\JsonParserException
Lazy traversal may yield nested Cline\Json\Tokens\Parser instances.
That nested parser type is part of the lazy traversal contract.
Lower-level namespaces such as Concerns\*, ValueObjects\*,
Sources\StreamWrapper, Sources\JsonResource, and most token support
classes exist for implementation and integration purposes. They are
autoloaded, but they are not the primary consumer API this package
optimizes around.
Benchmarks
The package ships with throughput and memory benchmarks. See BENCHMARK.md for when to use eager decode, eager parser materialization, and lazy/selective traversal.
Change log
Please see CHANGELOG for more information on what has changed recently.
Contributing
Please see CONTRIBUTING and CODE_OF_CONDUCT for details.
Security
If you discover any security related issues, please use the GitHub security reporting form rather than the issue queue.
Credits
License
The MIT License. Please see License File for more information.