PHPackages                             william/laravel-rigger - 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. william/laravel-rigger

ActiveLibrary

william/laravel-rigger
======================

Rigger for laravel

0.0.14(8y ago)1118MITPHP

Since Feb 8Pushed 8y ago1 watchersCompare

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

READMEChangelogDependencies (6)Versions (14)Used By (0)

laravel-rigger
==============

[](#laravel-rigger)

Laravel Rigger is inspired by [facebook/graphql](https://github.com/facebook/graphql), which is a query language for APIs. But I think its granularity is too thin to use in web development area. Using entity as query's minimum unit is better to generate a restful back-end swiftly based on a few necessary configuration, which describe the entities and relations.

Table of contents
=================

[](#table-of-contents)

- [Installation](#installation)
    - [Composer](#composer)
    - [Laravel](#laravel)
- [Entity Description](#entity-description)
    - [Relations](#relations)
    - [Query](#query)
    - [Include](#include)
    - [Authenticate and Authorize](#authenticate-and-authorize)

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

[](#installation)

### Composer

[](#composer)

```
composer require william/laravel-rigger

```

### Laravel

[](#laravel)

Only support Laravel &gt;= 5.5, and the ServiceProvider will be attached automatically. Publish entity config is necessary:

```
php artisan vendor:publish --provider "WilliamWei\LaravelRigger\Providers\LaravelRiggerProvider"

```

This will generate `config/entities.php` and `config/rigger.php` files. Then register the routes in `RouteServiceProvider`:

```
/**
 * Define the routes for the application.
 *
 * @return void
 */
public function map()
{
    $this->mapApiRoutes();

    $this->mapWebRoutes();

    Rigger::routes();
}
```

You can use this command to check generated routes.

```
php artisan route:list

```

Entity Description
------------------

[](#entity-description)

All the models/entities wanted to be handled by rigger should be defined in `config/entities.php`.

### Relations

[](#relations)

Support four relations: `hasOne` `belongsTo` `hasMany` `belongsToMany`. Items in these arrays can be an array or a string. Take `User` as an example, `User` may have many `Role`s through `user_role` table, so you can define it like this:

```
'belongsToMany' =>  [
    'roles',
]
```

If you want to modify the joining table, you can use an array:

```
'belongsToMany' =>  [
    ['roles', 'model_has_roles', 'model_id', 'role_id'],
]
```

All these definitions are consistent to the doc in

### Query

[](#query)

This part is powered by [andersao/l5-repository](https://github.com/andersao/l5-repository), and its most exciting function is allow front-end to perform a dynamic search, filter the data and customize the queries. Check the [Reference](https://github.com/andersao/l5-repository#using-the-requestcriteria)

Fields which can be searched by this way should be defined in `config/entities.php`. For example:

```
'user'  =>  [
    'searchableFields'    =>  [
        'name',
    ],
]
```

### Include

[](#include)

This part is powered by [spatie/laravel-fractal](https://github.com/spatie/laravel-fractal), and it allows front-end to include (a.k.a embedding, nesting or side-loading) relationships for complex data structures. For example, when you are querying `/users`, you may want to know their roles information at the same time. So you can add `include` parameters, like `/users?include=roles`:

```
{
	"data": [{
		"id": 1,
		"name": "rigger",
		"email": "rigger@email.com",
		"password": "rigger",
		"remember_token": "jsdklfjlsdjfl",
		"created_at": "2018-02-09 00:00:00",
		"updated_at": "2018-02-09 00:00:00",
		"roles": {
			"data": [{
				"id": 1,
				"name": "admin",
				"guard_name": "api",
				"created_at": "2018-02-09 00:00:00",
				"updated_at": "2018-02-09 00:00:00",
				"pivot": {
					"model_id": 1,
					"role_id": 1
				}
			}]
		}
	}]
}
```

All the relations defined in `hasOne` `belongsTo` `hasMany` and `belongsToMany` can be fetched by this way. If you want to add some limitations, you can add `availableIncludes` array to your entity. If so, keys only in the array can be parsed even though they defined in relations.

### Authenticate and Authorize

[](#authenticate-and-authorize)

Rigger use [spatie/laravel-permission](https://github.com/spatie/laravel-permission) as basic validator. There are three control layers in rigger: global layer, entity layer and action layer. In every layer, there exist two key words `authorize` and `authenticate` to control the behaviour. `authorize` describes which permissions or roles are needed, and `authenticate` determines whether the user need to login.

#### authenticate

[](#authenticate)

Only `true` of `false` can be set

#### authorize

[](#authorize)

```
'authorized'    =>  [
    'role'          =>  'admin',
    'permission'    =>  'update-user'
]
```

`role` and `permission` are supported. You can alse set placeholder `${action}` `${resource}` in the permission. For example, if you set `permission`as `${action}-${resource}` in user item, when visiting `GET /users`, permssion `index-user` will be required.

#### three control layers

[](#three-control-layers)

When visiting a specific action, it will check whether this resource has a detailed action-control, if so, then parse it. If not, it will use entity-control. However, if entity-control doesn't exist, global-control will active which located in `rigger.php`

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity60

Established project with proven stability

 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 ~5 days

Recently: every ~14 days

Total

13

Last Release

2953d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/e02a5000f7c98153429b72b334eaf21c294d4a89a51cdfbc80a1e2ed62b7f1b1?d=identicon)[WilliamWei](/maintainers/WilliamWei)

---

Top Contributors

[![IamBusy](https://avatars.githubusercontent.com/u/10692195?v=4)](https://github.com/IamBusy "IamBusy (24 commits)")

### Embed Badge

![Health badge](/badges/william-laravel-rigger/health.svg)

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

###  Alternatives

[livewire/livewire

A front-end framework for Laravel.

23.5k75.5M1.8k](/packages/livewire-livewire)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[masterro/laravel-mail-viewer

Easily view in browser outgoing emails.

6392.1k](/packages/masterro-laravel-mail-viewer)[fleetbase/core-api

Core Framework and Resources for Fleetbase API

1225.0k10](/packages/fleetbase-core-api)[dragon-code/laravel-http-logger

Logging incoming HTTP requests

319.8k3](/packages/dragon-code-laravel-http-logger)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

483.3k1](/packages/bjuppa-laravel-blog)

PHPackages © 2026

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