PHPackages                             toneflix-code/laravel-resource-modifier - 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. [Database &amp; ORM](/categories/database)
4. /
5. toneflix-code/laravel-resource-modifier

ActiveLibrary[Database &amp; ORM](/categories/database)

toneflix-code/laravel-resource-modifier
=======================================

A Laravel package that intercepts and help you customize, remove or modify the meta data on your eloquent api resource response.

1.1.5(1y ago)01.1k↓100%[4 PRs](https://github.com/toneflix/laravel-resource-modifier/pulls)1MITPHPPHP ^8.1|^8.2|^8.3CI passing

Since Aug 28Pushed 1mo agoCompare

[ Source](https://github.com/toneflix/laravel-resource-modifier)[ Packagist](https://packagist.org/packages/toneflix-code/laravel-resource-modifier)[ Docs](https://github.com/toneflix/laravel-resource-modifier)[ RSS](/packages/toneflix-code-laravel-resource-modifier/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (7)Dependencies (8)Versions (12)Used By (1)

Laravel Resource Modifier
=========================

[](#laravel-resource-modifier)

[![Test & Lint](https://github.com/toneflix/laravel-resource-modifier/actions/workflows/run-tests.yml/badge.svg?branch=main)](https://github.com/toneflix/laravel-resource-modifier/actions/workflows/run-tests.yml)[![Latest Stable Version](https://camo.githubusercontent.com/f4afb1d23d679c694003ae88fa44c7c9b2dde934b1bb283b02b75db995e34c1f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f746f6e65666c69782d636f64652f6c61726176656c2d7265736f757263652d6d6f6469666965722e737667)](https://packagist.org/packages/toneflix-code/laravel-resource-modifier)[![Total Downloads](https://camo.githubusercontent.com/498b09291cc8b7c5d1e1812836badc40cc9c42d007e7fa08b938cd40687975b3/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f746f6e65666c69782d636f64652f6c61726176656c2d7265736f757263652d6d6f6469666965722e737667)](https://packagist.org/packages/toneflix-code/laravel-resource-modifier)[![License](https://camo.githubusercontent.com/049de36f2eefe6c6038240c046eea880576f0acbabdd6dc3a00e89d60f960976/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f746f6e65666c69782d636f64652f6c61726176656c2d7265736f757263652d6d6f6469666965722e737667)](https://packagist.org/packages/toneflix-code/laravel-resource-modifier)[![PHP Version Require](https://camo.githubusercontent.com/427a488e0c905641203594216161b0734ab3b16f54c20578407a29ec0120d1ad/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646570656e64656e63792d762f746f6e65666c69782d636f64652f6c61726176656c2d7265736f757263652d6d6f6469666965722f706870)](https://packagist.org/packages/toneflix-code/laravel-resource-modifier)[![codecov](https://camo.githubusercontent.com/1edd6d6bddf558fd005dd5923c6b09870f3030daf968bd175910bf37d421f2cd/68747470733a2f2f636f6465636f762e696f2f67682f746f6e65666c69782f6c61726176656c2d7265736f757263652d6d6f6469666965722f67726170682f62616467652e7376673f746f6b656e3d324f376146756c513950)](https://codecov.io/gh/toneflix/laravel-resource-modifier)

A simple Laravel package that intercepts and help you customize, remove or modify the meta data on your Eloquent API Resource response, as well as automatically convert resource keys to camel case.

Features
--------

[](#features)

- Complete control over how Eloquent Api Resources are rendered and generated.
- Remove `meta` and `links` completely from the response if you want.
- If you choose to keep `meta` and `links`, you also have total control over `meta`'s \[`to`, `from`, `links`, `path`, `total`, `per_page`, `last_page`, `current_page`\] properties and `link`'s \[`first`, `last`, `prev`, `next`\] properties.
- Automatically convert resource keys to camel casing if needed.
- `php artisan mod:resource` to automatically generate API resources in place of `php artisan make:resource`;

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

[](#installation)

You can install the package via composer:

```
composer require toneflix-code/laravel-resource-modifier
```

Package Discovery
-----------------

[](#package-discovery)

Laravel automatically discovers and publishes service providers but optionally after you have installed Laravel Fileable, open your Laravel config file if you use Laravel below 11, `config/app.php` and add the following lines.

In the $providers array add the service providers for this package.

```
ToneflixCode\ResourceModifier\ResourceModifierServiceProvider::class
```

If you use Laravel &gt;= 11, open your `bootstrap/providers.php` and the above line to the array.

```
return [
    ToneflixCode\ResourceModifier\ResourceModifierServiceProvider::class,
];
```

Configuration
-------------

[](#configuration)

By default Laravel Resource Modifier doesn't really do anything different from what Laravel does, but now you can publish the configuration file and modify how Api Resources are presented by running the following artisan command.

Run `php artisan vendor:publish --tag="resource-modifier"`

Generating Resources
--------------------

[](#generating-resources)

To generate a resource class, you may use the `mod:resource` Artisan command. By default, resources will be placed in the `app/Http/Resources` directory of your application. Resources extend the `ToneflixCode\ResourceModifier\Services\Json\JsonResource` class:

```
artisan mod:resource UserResource
```

The configuration file will be copied to `config/resource-modifier.php`.

Resource Collections
--------------------

[](#resource-collections)

To create a resource collection, you should use the `--collection` flag when creating the resource. Or, including the word `Collection` in the resource name will indicate to Laravel that it should create a collection resource. Collection resources extend the `ToneflixCode\ResourceModifier\Services\Json\ResourceCollection` class:

```
php artisan mod:resource User --collection

php artisan mod:resource UserCollection
```

Overwriting the `make:resource` command
---------------------------------------

[](#overwriting-the-makeresource-command)

If you want Laravel Resource Modifier to handle your `php artisan make:resource` command by default, you can create a new command named `ResourceMakeCommand` with the following signature:

```
namespace App\Console\Commands;

use Symfony\Component\Console\Attribute\AsCommand;
use ToneflixCode\ResourceModifier\Commands\ResourceMakeCommand as ToneflixCodeResourceMakeCommand;

#[AsCommand(name: 'make:resource')]
class ResourceMakeCommand extends ToneflixCodeResourceMakeCommand
{
    protected $name = 'make:resource';
}
```

This will overide the default `ResourceMakeCommand` as Laravel will prefer user defined commands over built in ones, so the next time you call `php artisan make:resource UserCollection`, your collection will be created with the Laravel Resource Modifier signature.

Testing
-------

[](#testing)

```
composer test
```

Changelog
---------

[](#changelog)

Please see [CHANGELOG](CHANGELOG.md) for more information what has changed recently.

Contributing
------------

[](#contributing)

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.

Security
--------

[](#security)

If you discover any security related issues, please email  instead of using the issue tracker.

Credits
-------

[](#credits)

- [Toneflix Code](https://github.com/toneflix)
- [All Contributors](../../contributors)

License
-------

[](#license)

The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

###  Health Score

44

—

FairBetter than 91% of packages

Maintenance75

Regular maintenance activity

Popularity17

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity61

Established project with proven stability

 Bus Factor1

Top contributor holds 69.5% of commits — single point of failure

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.

###  Release Activity

Cadence

Every ~33 days

Recently: every ~44 days

Total

7

Last Release

417d ago

PHP version history (2 changes)1.0.0PHP ^8.2|^8.3

1.1.0PHP ^8.1|^8.2|^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/4638f9de973d94753ebff641af3009e1049064f9a6bd76fe87e58d0d8ddd7ca7?d=identicon)[3m1n3nc3](/maintainers/3m1n3nc3)

---

Top Contributors

[![3m1n3nc3](https://avatars.githubusercontent.com/u/52163001?v=4)](https://github.com/3m1n3nc3 "3m1n3nc3 (57 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (13 commits)")[![github-actions[bot]](https://avatars.githubusercontent.com/in/15368?v=4)](https://github.com/github-actions[bot] "github-actions[bot] (12 commits)")

---

Tags

responseapidataeloquentcollectionresourcerespondermodifyrespond

###  Code Quality

TestsPest

Code StyleLaravel Pint

### Embed Badge

![Health badge](/badges/toneflix-code-laravel-resource-modifier/health.svg)

```
[![Health](https://phpackages.com/badges/toneflix-code-laravel-resource-modifier/health.svg)](https://phpackages.com/packages/toneflix-code-laravel-resource-modifier)
```

###  Alternatives

[typicms/nestablecollection

A Laravel Package that extends Collection to handle unlimited nested items following adjacency list model.

88327.2k19](/packages/typicms-nestablecollection)[jedrzej/searchable

Searchable trait for Laravel's Eloquent models - filter your models using request parameters

127259.1k4](/packages/jedrzej-searchable)[jedrzej/withable

Withable trait for Laravel's Eloquent models

25193.2k2](/packages/jedrzej-withable)[torann/remote-model

An eloquent-like model, for the Laravel framework.

4814.4k](/packages/torann-remote-model)[matthenning/eloquent-api-filter

Awesome and simple way to filter Eloquent queries right from the API URL without the clutter.

104.9k](/packages/matthenning-eloquent-api-filter)

PHPackages © 2026

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