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

ActiveLibrary[API Development](/categories/api)

taylornetwork/laravel-api-resource
==================================

03PHP

Since Jun 18Pushed 6y ago1 watchersCompare

[ Source](https://github.com/taylornetwork/laravel-api-resource)[ Packagist](https://packagist.org/packages/taylornetwork/laravel-api-resource)[ RSS](/packages/taylornetwork-laravel-api-resource/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependenciesVersions (1)Used By (0)

Laravel Api Resource
====================

[](#laravel-api-resource)

This package provides an easy method implement API resource controllers without having to write similar code. This is helpful if you have several models that are accessed via API calls and don't have complex relations.

*Note: this readme is a work in progress*

Install
-------

[](#install)

Using Composer

```
$ composer require taylornetwork/laravel-api-resource
```

Setup
-----

[](#setup)

Models that will use this package must extend `TaylorNetwork\LaravelApiResource\Models\ApiResourceModel`, your models will continue to work as normal as the `ApiResourceModel` class extends Laravel's eloquent model class.

If your models are in a different namespace than `App\` be sure to publish the config and change `model_namespace` to your namespace.

Usage
-----

[](#usage)

When creating a new controller related to a specfic model, all you need to do is extend `TaylorNetwork\LaravelApiResource\Controllers\ApiResourceController` and that handles Laravel's resource calls.

### Example

[](#example)

For example if you have a model `App\Customer` and you want to access it via API calls.

#### Model

[](#model)

The Customer model will have a required `name` field that we can add to the `$validationRules` property.

```
// app/Customer.php

namespace App;

use TaylorNetwork\LaravelApiResource\Models\ApiResourceModel;

class Customer extends ApiResourceModel
{
	protected $validationRules = [
		'name' => 'required',
	];

	protected $fillable = [
		'name', 'email', 'address',
	];
}
```

#### Routes

[](#routes)

The routes must be added to `routes/api.php`

```
// routes/api.php

Route::apiResource('customer', 'Api\\CustomerController');
```

#### Controller

[](#controller)

This is all the code required to handle the API calls, the `ApiResourceController` handles all related routes.

```
// app/Http/Controllers/Api/CustomerController.php

namespace App\Http\Controllers\Api;

use TaylorNetwork\LaravelApiResource\Controllers\ApiResourceController;

class CustomerController extends ApiResourceController
{

}
```

If you have a more complex relation for a specfic route, you can override that in your controller.

```
// app/Http/Controllers/Api/CustomerController.php

namespace App\Http\Controllers\Api;

use TaylorNetwork\LaravelApiResource\Controllers\ApiResourceController;
use App\Customer;

class CustomerController extends ApiResourceController
{
	public function show($id)
	{
		return Customer::with('someRelation')->find($id);
	}
}
```

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity3

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity34

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/83340094473f0bf5b2cf062bf394df221a52a30aa0e21cd0a77302977d6393ce?d=identicon)[samueljtaylor](/maintainers/samueljtaylor)

---

Top Contributors

[![samyrataylor](https://avatars.githubusercontent.com/u/15961687?v=4)](https://github.com/samyrataylor "samyrataylor (2 commits)")

### Embed Badge

![Health badge](/badges/taylornetwork-laravel-api-resource/health.svg)

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

###  Alternatives

[exsyst/swagger

A php library to manipulate Swagger specifications

35816.5M7](/packages/exsyst-swagger)[lucasdotvin/laravel-soulbscription

A straightforward interface to handle subscriptions and features consumption.

709209.3k](/packages/lucasdotvin-laravel-soulbscription)[pimax/fb-messenger-php

Facebook Messenger Bot PHP API

313188.5k2](/packages/pimax-fb-messenger-php)

PHPackages © 2026

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