PHPackages                             filipedtristao/laravel-crud-builder - 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. [Admin Panels](/categories/admin)
4. /
5. filipedtristao/laravel-crud-builder

ActiveLibrary[Admin Panels](/categories/admin)

filipedtristao/laravel-crud-builder
===================================

v0.0.2(5y ago)54.7k2[3 PRs](https://github.com/filipedtristao/laravel-crud-builder/pulls)MITPHPPHP ^7.1

Since Mar 11Pushed 3y ago1 watchersCompare

[ Source](https://github.com/filipedtristao/laravel-crud-builder)[ Packagist](https://packagist.org/packages/filipedtristao/laravel-crud-builder)[ Docs](https://github.com/filipedtristao/laravel-crud-builder)[ RSS](/packages/filipedtristao-laravel-crud-builder/feed)WikiDiscussions master Synced yesterday

READMEChangelog (2)Dependencies (5)Versions (6)Used By (0)

Create and update Eloquent models from API Requests
===================================================

[](#create-and-update-eloquent-models-from-api-requests)

This package allows you to create and update your Eloquent model and sync relationships based on a request. Request parameter names follow the [JSON API specification](http://jsonapi.org/) as closely as possible.

**Note:** Inspired in [Spatie's query builder package](https://github.com/spatie/laravel-query-builder).

Basic usage
-----------

[](#basic-usage)

### Create a model based on a Request:

[](#create-a-model-based-on-a-request)

Request body:

```
{
  data: {
    attributes: {
      name: 'Paul',
      age: 77
    }
  }
}
```

PHP controller code:

```
  use CrudBuilder\CrudBuilder;

  $singer = CrudBuilder::for(Singer::class)
    ->allowedAttributes('age', 'name')
    ->create();

  //A singer is created in database with the request data
```

### Update a model based on a Request:

[](#update-a-model-based-on-a-request)

Request body:

```
{
  data: {
    id: 1,
    attributes: {
      name: 'Paul',
      age: 77
    }
  }
}
```

PHP controller code:

```
  use CrudBuilder\CrudBuilder;

  $singer = CrudBuilder::for(Singer::class)
    ->allowedAttributes('age', 'name')
    ->update();

  //A singer with the requested id is updated in database with the request data
```

Is sure possible to create or update based on the presence of ID in the Request with the `->createOrUpdate()` method.

### Update a model based on a Request, ignoring some attributes:

[](#update-a-model-based-on-a-request-ignoring-some-attributes)

Request body:

```
{
  data: {
    id: 1,
    attributes: {
      name: 'Paul',
      surname: 'McCartney',
      age: 77
    }
  }
}
```

PHP controller code:

```
  use CrudBuilder\CrudBuilder;

  $singer = CrudBuilder::for(Singer::class)
    ->ignoreAttributes('age', 'surname')
    ->allowedAttributes('name')
    ->update();

  //A singer with the requested id is updated in database with the request data, except the ignored attributes
```

### Update a model based on a Request, including relationships:

[](#update-a-model-based-on-a-request-including-relationships)

Request body:

```
{
  data: {
    id: 1,
    attributes: {
      name: 'Paul'
    },
    relationships: {
      band: {
        data: {
          id: 1
        }
      }
    }
  }
}
```

PHP model code:

```
class SingerModel extends Model
{
  public function band()
  {
      return $this->belongsTo(Band::class);
  }
}
```

PHP controller code:

```
  use CrudBuilder\CrudBuilder;

  $singer = CrudBuilder::for(Singer::class)
    ->allowedAttributes('name')
    ->allowedRelations('band')
    ->update();

  //A singer with the requested id is updated in database with the request data, including the relationship
```

**Note:** The only supported relationships so far are: BelongsTo and HasMany.

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity45

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 93.9% 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 ~110 days

Total

2

Last Release

2143d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/10791793?v=4)[Filipe Tristão](/maintainers/filipedtristao)[@filipedtristao](https://github.com/filipedtristao)

---

Top Contributors

[![filipedtristao](https://avatars.githubusercontent.com/u/10791793?v=4)](https://github.com/filipedtristao "filipedtristao (31 commits)")[![wilianx7](https://avatars.githubusercontent.com/u/42422976?v=4)](https://github.com/wilianx7 "wilianx7 (2 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/filipedtristao-laravel-crud-builder/health.svg)

```
[![Health](https://phpackages.com/badges/filipedtristao-laravel-crud-builder/health.svg)](https://phpackages.com/packages/filipedtristao-laravel-crud-builder)
```

###  Alternatives

[pressbooks/pressbooks

Pressbooks is an open source book publishing tool built on a WordPress multisite platform. Pressbooks outputs books in multiple formats, including PDF, EPUB, web, and a variety of XML flavours, using a theming/templating system, driven by CSS.

44643.1k1](/packages/pressbooks-pressbooks)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[api-platform/laravel

API Platform support for Laravel

59126.4k6](/packages/api-platform-laravel)[adminui/inertia-routes

A hybrid JS/PHP package adding Ziggy-routes functionality to your Laravel/Inertia/Vue3 application

183.2k](/packages/adminui-inertia-routes)[bjuppa/laravel-blog

Add blog functionality to your Laravel project

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

PHPackages © 2026

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