I'm dealing now with pagination of search results in my API made in Laravel and I came across this in the documentation:
https://laravel.com/docs/5.3/pagination#converting-results-to-json
It seems nice but at the same time I'm quite concerned about the fact that it alters the structure of the result, since it hides the returned data inside the "data" key.
The problem is, until now I was returning a non-paginated JSON-encoded array of objects and including pagination this way would either require making remarkable modifications in the front-end or it would bring inconsitency across the API (there would be API calls which return the data nested and other ones which return them directly - I don't like it).
I would probably like more to include the pagination metadata in the header of the response which won't mess up my current structure of responses. Do you know about any out-of-the-box solution like this (ideally a Laravel package)? Or what other approach would you recommend me to resolve my dilemma?

