I have gone through similar situation and what I did is splitting the query and loop through it, to get the partially sorted data.
for eg: To sort your query by city, can split the query like this,
$results = $rets->Search("Property","RESI","(City=|Apple Valley),(Status=|A)",["Limit"=>5]);
$results = $rets->Search("Property","RESI","(City=|Hesperia),(Status=|A)",["Limit"=>5]);
$results = $rets->Search("Property","RESI","(City=|Victorville),(Status=|A)",["Limit"=>5]);
Then loop through these queries.
Similarly, we can split the query based on each year/month or based on any listing status etc.
Hope sorting option will be provided by RETS in near future.