Vous avez un gros fichier JSON à parser ?

La librairie json-parser, permet d’éviter de le charger en mémoire pour le parcourir.

Exemple

// a source is anything that can provide a JSON, in this case an endpoint
$source = 'https://randomuser.me/api/1.4?seed=json-parser&results=5';
 
foreach (new JsonParser($source) as $key => $value) {
    // instead of loading the whole JSON, we keep in memory only one key and value at a time
}