PHPackages                             foothing/laravel-repository-controller - 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. [Framework](/categories/framework)
4. /
5. foothing/laravel-repository-controller

ActiveLibrary[Framework](/categories/framework)

foothing/laravel-repository-controller
======================================

Resources controller with Eloquent Laravel Repository implementation.

0.2.0(9y ago)213311MITPHPPHP &gt;=5.5.0CI failing

Since Jul 25Pushed 5y ago2 watchersCompare

[ Source](https://github.com/foothing/laravel-repository-controller)[ Packagist](https://packagist.org/packages/foothing/laravel-repository-controller)[ RSS](/packages/foothing-laravel-repository-controller/feed)WikiDiscussions master Synced 4w ago

READMEChangelogDependencies (6)Versions (5)Used By (1)

Laravel Repository Controller
=============================

[](#laravel-repository-controller)

Easily open an HTTP api over your Laravel database.

Setup
-----

[](#setup)

Install with composer:

`composer require foothing/laravel-repository-controller`

This package will define several routes in a REST-like format that will perform operations on your database.

Add the service provider in `config/app.php`:

```
	"providers" => [

		Foothing\RepositoryController\RepositoryControllerServiceProvider::class,

	],
```

In order to enable the routes, you'll need to declare them in your `routes.php`:

```
	// ... your app routes

	RouteInstaller::install('api/v1/');
```

> Be careful and place the `RouteInstaller::install()` method at the very end of your `routes.php` in order to avoid conflicts.

> IMPORTANT: you will need to change the default Controllers namespace in `RouteServiceProvider` like so: `protected $namespace = '';`

Finally, configure your resources in the config file.

```
php artisan vendor:publish --provider="Foothing\RepositoryController\RepositoryControllerServiceProvider" --tag="config"

```

This will add the `resources.php` file in your `config` folder.

```
'resources' => array(

	// Resources must be in the form 'resourceName' => 'resourceImplementation'
	// The implementation should be a fully qualified namespace to the model.

	'user' => 'App\User',
	'foo'  => 'My\Namespace\Foo',
),
```

This will enable the routes on the specified resources.

How to use
----------

[](#how-to-use)

The `RouteInstaller` will declare the package routes. You can specify a prefix as an optional `install()` argument. The process will enable the following routes, which we'll describe in better details later.

VERBUrlNotesGET`[optionalPrefix]/resources/{resource}/{id?}/{args?}`Read resourcesPOST`[optionalPrefix]/resources/{resource}`Create resourcesPUT`[optionalPrefix]/resources/{resource}/{id}`Update resourcesDELETE`[optionalPrefix]/resources/{resource}/{id}`Delete resourcesPUT`resources/{resource}/{id?}/link/{relation}/{related}/{relatedId}`Attach many-to-manyDELETE`resources/{resource}/{id?}/link/{relation}/{related}/{relatedId}`Detach many-to-manyPOST`resources/bulk/{resource}`Bulk create resourcesPUT`resources/bulk/{resource}`Bulk update resourcesEach api endpoint will return data in `JSON` format.

### Read resources

[](#read-resources)

VerbUrlPayloadGET`[optionalPrefix]/resources/{resource}/{id?}/{args?}`*none***Examples**

- `GET api/v1/resources/user`: will return all users
- `GET api/v1/resources/user/15`: will return user with id = 15
- `GET api/v1/resources/user/15/roles` will return user 15 roles

**Pagination**

This endpoint will handle 2 querystring args for pagination:

- page (pagination page)
- ipp (pagination items-per-page)

The result will be a Laravel paginated result like:

```
{
	"total":4,
	"per_page":"25",
	"current_page":1,
	"last_page":1,
	"next_page_url":null,
	"prev_page_url":null,
	"from":1,
	"to":4,
	"data":[ the resources array ]
}
```

**Related resources**

You can pass an optional `with` query string argument that will be used to fetch relations within the requested resource:

`GET api/v1/resources/user/1?with=roles,posts`

**Auto eager loading relations**

Since this package relies on [Laravel Repository](https://github.com/foothing/laravel-repository) you can take advantage of that package *eager loading* features therefore enabling auto eager-load features on each resource.

### Create resources

[](#create-resources)

Create the requested resource.

VerbUrlPayloadPOST`[optionalPrefix]/resources/{resource}`{resourceData}**Example**

`POST api/v1/resources/user`

**POST payload**

```
{
	name: 'foo',
	email: 'foo@bar.baz'
}
```

**HTTP Response**

```
{
	id: 1,
	name: 'foo',
	email: 'foo@bar.baz'
}
```

### Update resources

[](#update-resources)

Update the requested resource.

VerbUrlPayloadPUT`[optionalPrefix]/resources/{resource}/{id}`{resourceData}**Example**

`PUT api/v1/resources/user/1`

**PUT payload**

```
{
	id: 1,
	name: 'updating name',
	email: 'foo@bar.baz'
}
```

**HTTP Response**

```
{
	id: 1,
	name: 'updating name',
	email: 'foo@bar.baz'
}
```

### Delete resources

[](#delete-resources)

Delete the requested resource.

VerbUrlPayloadDELETE`[optionalPrefix]/resources/{resource}/{id}`*none***Example**

`DELETE api/v1/resources/user/1`

### Link, bulk create and bulk update

[](#link-bulk-create-and-bulk-update)

More info coming soon.

LICENSE
-------

[](#license)

MIT

###  Health Score

26

—

LowBetter than 41% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity14

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

Maturing project, gaining track record

 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.

###  Release Activity

Cadence

Every ~2 days

Total

3

Last Release

3623d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/9ebf3a4938226620036760ed05bf0d6801b7bc2c383a1fd7dd1a4c48ba84145d?d=identicon)[brazorf](/maintainers/brazorf)

---

Top Contributors

[![brazorf](https://avatars.githubusercontent.com/u/3330031?v=4)](https://github.com/brazorf "brazorf (22 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/foothing-laravel-repository-controller/health.svg)

```
[![Health](https://phpackages.com/badges/foothing-laravel-repository-controller/health.svg)](https://phpackages.com/packages/foothing-laravel-repository-controller)
```

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k84.3M2.5k](/packages/livewire-livewire)[laravel/boost

Laravel Boost accelerates AI-assisted development by providing the essential context and structure that AI needs to generate high-quality, Laravel-specific code.

3.5k17.6M518](/packages/laravel-boost)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M137](/packages/laravel-cashier)[laravel/mcp

Rapidly build MCP servers for your Laravel applications.

77018.2M122](/packages/laravel-mcp)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M123](/packages/laravel-pulse)[laravel/wayfinder

Generate TypeScript representations of your Laravel actions and routes.

1.8k7.0M119](/packages/laravel-wayfinder)

PHPackages © 2026

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