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 today

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://avatars.githubusercontent.com/u/12786153?v=4)[Chris Arter](/maintainers/christopherarter)[@christopherarter](https://github.com/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

[exsyst/swagger

A php library to manipulate Swagger specifications

35916.4M7](/packages/exsyst-swagger)[hubspot/api-client

Hubspot API client

24016.2M20](/packages/hubspot-api-client)[pocketmine/bedrock-protocol

An implementation of the Minecraft: Bedrock Edition protocol in PHP

172445.0k15](/packages/pocketmine-bedrock-protocol)[botman/driver-telegram

Telegram driver for BotMan

93459.5k6](/packages/botman-driver-telegram)

PHPackages © 2026

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