PHPackages                             baethon/laravel-resource - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [HTTP &amp; Networking](/categories/http)
4. /
5. baethon/laravel-resource

ActiveLibrary[HTTP &amp; Networking](/categories/http)

baethon/laravel-resource
========================

Conveniant factory for Laravel API resources

v1.0.2(5y ago)41.3k1[3 issues](https://github.com/baethon/laravel-resource/issues)[1 PRs](https://github.com/baethon/laravel-resource/pulls)MITPHP

Since Apr 10Pushed 3y ago1 watchersCompare

[ Source](https://github.com/baethon/laravel-resource)[ Packagist](https://packagist.org/packages/baethon/laravel-resource)[ RSS](/packages/baethon-laravel-resource/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (3)Dependencies (5)Versions (5)Used By (0)

baethon/laravel-resource
========================

[](#baethonlaravel-resource)

[![Example](https://raw.githubusercontent.com/baethon/laravel-resource/master/example.png)](https://raw.githubusercontent.com/baethon/laravel-resource/master/example.png)

The package provides a convenient factory function for [Laravel API Resources](https://laravel.com/docs/8.x/eloquent-resources). Based on the given model, it will try to find the corresponding API resource and return it. If the resource doesn't exist, it will use the base `JsonResource` class. It works with collections.

Installation
------------

[](#installation)

```
composer require baethon/laravel-resource

```

Example usage
-------------

[](#example-usage)

```
