You can use the collect() function in $users to transform your response in a Laravel collection. Then you can sort using the sortBy method.
$users = collect($json['documents'])
$sorted = $users->sortBy('created_at');
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
this code responsible for retrieving data and make a pagination from firestore
$limit = 10;
$url = 'm-url'&pageSize='.$limit.'&pageToken='.$nextPageToken;
$json = json_decode(file_get_contents($url), true);
$users = $json['documents'];
I want to use orderBy and get the data on basis of created_at field ?
Please or to participate in this conversation.