DEV Community

Discussion on: Laravel API - The best way to Return the uniform Response for all type of Requests

Collapse
 
stephenjude profile image
Stephen Jude

Nice. I use Laravel Responder for this. It also returns uniform response for Laravel base response or errors like firstOrFail(), abort() etc.

You can check it out here github.com/flugger/laravel-responder

Collapse
 
bawa_geek profile image
Lakh Bawa • Edited

Hmm, that's also not bad, But I guess, to use that, We must be using Fractal Package, which is no longer required with the New Version of Laravel as we already have the functionality of Fractal in laravel core now

Collapse
 
stephenjude profile image
Stephen Jude

Can you point me to that?

Thread Thread
 
bawa_geek profile image
Lakh Bawa

I believe Laravel response has the dependency on github.com/thephpleague/fractal which is no longer required as We have Laravel Api Resources now

laravel.com/docs/8.x/eloquent-reso...

Thread Thread
 
stephenjude profile image
Stephen Jude

Oops, didn't know that's what you are referring to. Its been there for a while. Since 5.5

I fractal works for me.

Thread Thread
 
bawa_geek profile image
Lakh Bawa

yeah, thats true