Courses

How to Build Laravel 11 API From Scratch

Useful Packages

Summary of this lesson:
- Laravel API Response Helpers for standardized responses
- Laravel Orion for quick REST API creation
- Laravel API Tool Kit for code generation
- Laravel Restify for API boilerplate generation

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 23 lessons of this course? (58 min read)

You also get:

  • 69 courses (majority in latest Laravel 11)
  • Premium tutorials
  • Access to repositories
  • Private Discord