PHPackages                             christopherarter/laravel-resourceable - 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. [API Development](/categories/api)
4. /
5. christopherarter/laravel-resourceable

ActiveLibrary[API Development](/categories/api)

christopherarter/laravel-resourceable
=====================================

A handy method for accessing a model's value as an API resource

2571[1 issues](https://github.com/christopherarter/laravel-resourceable/issues)PHPCI failing

Since Mar 11Pushed 6y ago1 watchersCompare

[ Source](https://github.com/christopherarter/laravel-resourceable)[ Packagist](https://packagist.org/packages/christopherarter/laravel-resourceable)[ RSS](/packages/christopherarter-laravel-resourceable/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

### Laravel Resourceable

[](#laravel-resourceable)

Laravel Resourceable is a package allowing you to quickly access a model's array value from an Api Resource class.

#### Installation

[](#installation)

```
composer require christopherarter/laravel-resourceable

```

#### Examples

[](#examples)

```
$user = new User([...]);

return $user->toResourceArray();

```

This package will automatically look for the resource class defined in the `App\Http\Resources` namespace with your **ClassName** + **Resource** appended. So for our user example, it would resolve to `App\Http\Resources\UserResource`.

You may also use a custom API Resource class from any namespace as a parameter:

```

return $user->toResourceArray(AlternateResource::class);

```

#### Why?

[](#why)

This allows for very accurate API HTTP testing of an endpoint, for example:

```

// UserTest.php

$user = factory(\App\User::class)->create();

$this->get(route('users.show'))

->assertJson($user->toResourceArray());

```

#### Credit

[](#credit)

This package was written by Chris Arter with valuable contributions by [Dan Alverez](https://github.com/bayareawebpro)

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance10

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community5

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/990cfbdeab8ba6fd8c12d682db3e9723e22350bb8b377d91d692927f3e195241?d=identicon)[christopherarter](/maintainers/christopherarter)

### Embed Badge

![Health badge](/badges/christopherarter-laravel-resourceable/health.svg)

```
[![Health](https://phpackages.com/badges/christopherarter-laravel-resourceable/health.svg)](https://phpackages.com/packages/christopherarter-laravel-resourceable)
```

###  Alternatives

[stripe/stripe-php

Stripe PHP Library

4.0k143.3M480](/packages/stripe-stripe-php)[twilio/sdk

A PHP wrapper for Twilio's API

1.6k92.9M271](/packages/twilio-sdk)[knplabs/github-api

GitHub API v3 client

2.2k15.8M187](/packages/knplabs-github-api)[facebook/php-business-sdk

PHP SDK for Facebook Business

90121.9M34](/packages/facebook-php-business-sdk)[meilisearch/meilisearch-php

PHP wrapper for the Meilisearch API

73813.7M114](/packages/meilisearch-meilisearch-php)[google/gax

Google API Core for PHP

263103.1M454](/packages/google-gax)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
