classes as $class) { $provider = new $class(); foreach($provider as $key => $value) { $json = json_encode($provider->{$key}, JSON_PRETTY_PRINT); Storage::disk('local')->put($key.'.json', $json); } } } }