PHPackages                             berthott/laravel-crudable - 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. berthott/laravel-crudable

ActiveLibrary[Framework](/categories/framework)

berthott/laravel-crudable
=========================

Laravel Helper for CRUD Resources

3.0.7(1y ago)01.5k↓81.8%3MITPHP

Since Sep 9Pushed 1y ago3 watchersCompare

[ Source](https://github.com/berthott/laravel-crudable)[ Packagist](https://packagist.org/packages/berthott/laravel-crudable)[ RSS](/packages/berthott-laravel-crudable/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (1)Dependencies (7)Versions (36)Used By (3)

[![test workflow](https://github.com/berthott/laravel-crudable/actions/workflows/test.yml/badge.svg)](https://github.com/berthott/laravel-crudable/actions/workflows/test.yml/badge.svg)

Laravel-Crudable
================

[](#laravel-crudable)

A helper for CRUD routes in Laravel.

Easily add a complete CRUD route + controller by adding a trait to your model.

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

[](#installation)

```
$ composer require berthott/laravel-crudable
```

Concept
-------

[](#concept)

The package implements a generic approach onto CRUD routes moving the setup of those routes from the several different places (routes / controller) into the model itself. This does'nt prevent you from adding your own custom routes and controllers. There are helper methods if you need the additionally created route in a specific order.

### Frontend connection

[](#frontend-connection)

The index route does not implement any pagination. This is to be considered when implementing the connection to this route as this means a potentially huge payload:

- Try to avoid eagerly loaded relations when they contain a lot of data (do not use them in `$with` array)
    - To add the information on the relations with minimal data size you can add an [attribute](https://laravel.com/docs/10.x/eloquent-mutators#accessors-and-mutators) holding the relations ids. TODO: This could be done by the package automatically
- If you wan't to eagerly load relations only in the show route you can use `showRelations()`

TODO: An optional pagination could help here in the future.

Usage
-----

[](#usage)

- Create your table and corresponding model, eg. with `php artisan make:model YourModel -m`
- Add the `Crudable` trait to your newly generated model.
- The package will register these standard API CRUD routes (see [API Resource Routes](https://laravel.com/docs/10.x/controllers#api-resource-routes)).
    - Index, *get* `yourmodels/` =&gt; get all entities
    - Show, *get* `yourmodels/{yourmodel}` =&gt; get a single entity
    - Create, *post* `yourmodels/` =&gt; create a new entity
    - Update, *put* `yourmodels/{yourmodel}` =&gt; update an entity
    - Destroy, *delete* `yourmodels/{yourmodel}` =&gt; delete an entity
- Additionally it registers
    - Destroy many, *delete* `yourmodels/destroy_many` =&gt; delete many entities by their given ids
    - Schema, *get* `yourmodels/schema` =&gt; get the database schema
- Add relations implementing one of the following methods
    - `attachables()` to attach existing related models to the model
    - `creatables()` to create new related models and attach them to the model
    - `customRelations()` to implement your very own behavior for adding relations to the model
- For more information on how to setup certain features see `\berthott\Crudable\Models\Traits\Crudable`.

Options
-------

[](#options)

To change the default options use

```
$ php artisan vendor:publish --provider="berthott\Crudable\CrudableServiceProvider" --tag="config"
```

- Inherited from [laravel-targetable](https://docs.syspons-dev.com/laravel-targetable)
- `namespace`: String or array with one ore multiple namespaces that should be monitored for the configured trait. Defaults to `App\Models`.
- `namespace_mode`: Defines the search mode for the namespaces. `ClassFinder::STANDARD_MODE` will only find the exact matching namespace, `ClassFinder::RECURSIVE_MODE`will find all subnamespaces. Defaults to `ClassFinder::STANDARD_MODE`.
- `prefix`: Defines the route prefix. Defaults to `api`.
- General Package Configuration
    - `middleware`: An array of all middlewares to be applied to all of the generated routes. Defaults to `['api']`.

Architecture
------------

[](#architecture)

- The package relies on [laravel-targetable](https://docs.syspons-dev.com/laravel-targetable) to connect specific functionality to Laravel model entities via a trait. (`Crudable`).

Compatibility
-------------

[](#compatibility)

Tested with Laravel 10.x.

License
-------

[](#license)

See [License File](license.md). Copyright © 2023 Jan Bladt.

###  Health Score

35

—

LowBetter than 77% of packages

Maintenance36

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community15

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 95.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 ~34 days

Recently: every ~105 days

Total

35

Last Release

583d ago

Major Versions

1.0.13 → 2.0.02022-03-23

2.1.7 → 3.0.02023-02-16

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/3034025?v=4)[Jan Bladt](/maintainers/berthott)[@berthott](https://github.com/berthott)

---

Top Contributors

[![berthott](https://avatars.githubusercontent.com/u/3034025?v=4)](https://github.com/berthott "berthott (85 commits)")[![OrSarfati](https://avatars.githubusercontent.com/u/154224737?v=4)](https://github.com/OrSarfati "OrSarfati (4 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/berthott-laravel-crudable/health.svg)

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

###  Alternatives

[yorcreative/laravel-scrubber

A laravel package that scrubs sensitive information for you.

15776.6k2](/packages/yorcreative-laravel-scrubber)[typicms/base

A modular multilingual CMS built with Laravel, enabling developers to manage structured content like pages, news, events, and more.

1.6k20.4k](/packages/typicms-base)[fusioncms/cms

Core of FusionCMS

431.2k3](/packages/fusioncms-cms)

PHPackages © 2026

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