In Laravel 5.5+, we can use API resource to format our API response in a way we want. I want to create API resource in Laravel 5.4 project which I can't upgrade to 5.5. Is there any way to use API resource in Laravel 5.4?
If not, what is the best way to format response and how to properly format responses while creating an API with Laravel? What are the tips and best practices to create API in Laravel version 5.4, 5.3, 5.2 etc?