Skip to main content

Useful Packages

Premium
4 min read

In this last lesson, let's check four packages that could be useful when working with APIs.


1. Laravel API Response Helpers

The first package, Laravel API Response Helpers, helps you to standardize responses.

If you return a lot of return response()->json(), this package might help you. We can install this package via composer.

composer require f9webltd/laravel-api-response-helpers

Then, add trait F9Web\ApiResponseHelpers to any Controller you want to use helpers. Now, we can use helpers from the package. For example, return a successful response:

use F9Web\ApiResponseHelpers;
 
class ProductController extends Controller
{
ApiResponseHelpers;
 
public function index()
{
$products = Product::with('category')->paginate(9);
 
return responseWithSuccess($products);
}
}

You can check other helper methods in the official documentation.

You can watch the video version of the package review on YouTube: Laravel Package For Standard API Responses.

The Full Lesson is Only for Premium Members

Want to access all of our courses? (30 h 33 min)

You also get:

55 courses
Premium tutorials
Access to repositories
Private Discord
Get Premium for $129/year or $29/month

Already a member? Login here

Comments & Discussion

No comments yet…

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.