0PricingLogin
PHP Academy · Lesson

API Resources and JSON Responses

Shape JSON output with Eloquent API Resources and ResourceCollections.

What Are API Resources?

Eloquent API Resources transform models and collections into JSON-ready arrays, giving you full control over the shape of your API responses.

Generating a Resource

Create a resource class with Artisan.

$ php artisan make:resource UserResource
# For collections:
$ php artisan make:resource UserCollection

All lessons in this course

  1. API Routes and Resource Controllers
  2. API Resources and JSON Responses
  3. Authentication with Laravel Sanctum
  4. Rate Limiting and API Versioning
← Back to PHP Academy