I am doing pagination in REST api developed over slim.Using below API to get current uri
(string) $request->getUri();
RESULT ::http://localhost/slim/test_app/test/public/api/actions/?page=2
But now for next request i need to replace the page number in current url to (+1) ie 3 here and pass in data returned to user like below
{"data":[//data]"next": http://localhost/slim/test_app/test/public/api/actions/?page=3}
What could be the best way to replace the page number ? Do we have any direct api for this,to just replace the attributes ?