notalentgeek's avatar

How can I use JSON API Resource in a Lumen project?

In Laravel it can be done as simply as it is described here: https://laravel.com/docs/5.6/eloquent-resources.

Some says, API Resources is not meant for Lumen. However, just for the sake of this question, I want to know, strictly, if there is a way on how to add Laravel JSON API Resource in a Lumen project (the package use Illuminate\Http\Resources\Json\JsonResource; is missing from freshly created Lumen project).

0 likes
1 reply
bobbybouwmann's avatar

Well that's true! I think if you include the illuminate/http in your composer.json you should be good to go. That package contains the resource files ;)

However I see that Lumen is already including this dependency. So it should be available. Note that I only looked at the latest Lumen ;)

Please or to participate in this conversation.