PHPackages                             sirgrimorum/crudgenerator - 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. sirgrimorum/crudgenerator

ActiveLibrary[Framework](/categories/framework)

sirgrimorum/crudgenerator
=========================

Automatic CRUD generator for Laravel

3.8.38(2mo ago)1370↓50%1MITJavaScriptPHP ^8.2CI failing

Since Feb 23Pushed 2mo ago1 watchersCompare

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

READMEChangelogDependencies (11)Versions (112)Used By (1)

CrudGenerator
=============

[](#crudgenerator)

[![Latest Version on Packagist](https://camo.githubusercontent.com/279a5dac5a56edc6ebe0393602a5f8d51f1658a01c2e93b5e7f8efbe1881916d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/279a5dac5a56edc6ebe0393602a5f8d51f1658a01c2e93b5e7f8efbe1881916d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)[![PHP Version](https://camo.githubusercontent.com/7542784bc67988a055f6ff446c69f556aeefceec244d2aef9e3ed15f52ffa8ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/7542784bc67988a055f6ff446c69f556aeefceec244d2aef9e3ed15f52ffa8ea/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)[![Total Downloads](https://camo.githubusercontent.com/2af67b6bf260ce3a061391e900da2744173c7609bdbd9726b9ab658b46eadc23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/2af67b6bf260ce3a061391e900da2744173c7609bdbd9726b9ab658b46eadc23/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)[![License](https://camo.githubusercontent.com/533b20cc81f868d6e327b22cb7c8a0f5eddb55f7876051231f25839f60491bc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)](https://camo.githubusercontent.com/533b20cc81f868d6e327b22cb7c8a0f5eddb55f7876051231f25839f60491bc4/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7369726772696d6f72756d2f6372756467656e657261746f722e7376673f7374796c653d666c61742d737175617265)

A config-driven CRUD framework for Laravel. Describe your model's fields in a PHP array and get a fully functional admin interface — create/edit forms, show views, searchable DataTables lists, file uploads, relationship selects, validation, and REST endpoints — without writing controllers, views, or JS glue code.

Features
--------

[](#features)

- **20+ field types** — text, email, password, number, textarea, HTML (CKEditor), date/datetime/time, select, checkbox, radio, relationship (BelongsTo), relationships (ManyToMany), files (single and multiple), color picker, range slider, JSON editor, computed functions, and more
- **Auto-generated admin** — create, show, edit, list, and delete views from a single config array
- **DataTables integration** — server-side or client-side paging, search, multi-select, export (Excel, PDF, copy)
- **Validation** — reads `$rules` from the model; custom validators for composite unique, older-than age, unique-with
- **File uploads** — single or multiple files, automatic image resizing/thumbnailing, disk/path configurable
- **Relationship fields** — `BelongsTo` selects, `ManyToMany` with pivot columns, typeahead search
- **Access control** — permission closure in config; per-action permission checks
- **Dynamic value prefixes** — `__route__`, `__trans__`, `__asset__`, `__config__`, `__view__`, and more evaluated at render time
- **Modal support** — create/edit forms can be embedded in Bootstrap modals
- **Artisan code generation** — scaffold model config, language file, Eloquent model class, and getter methods
- **TransArticles integration** — `article` field type stores rich content in the articles table

Requirements
------------

[](#requirements)

- PHP &gt;= 8.2
- Laravel &gt;= 9.0
- intervention/image ^3.0
- doctrine/dbal ^3.0|^4.0

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

[](#installation)

```
composer require sirgrimorum/crudgenerator
```

### Run migrations

[](#run-migrations)

```
php artisan migrate
```

### Publish configuration

[](#publish-configuration)

```
php artisan vendor:publish --provider="Sirgrimorum\CrudGenerator\CrudGeneratorServiceProvider" --tag=config
```

Publishes `config/sirgrimorum/crudgenerator.php`.

### Publish language files

[](#publish-language-files)

```
php artisan vendor:publish --provider="Sirgrimorum\CrudGenerator\CrudGeneratorServiceProvider" --tag=lang
```

### Publish views (optional)

[](#publish-views-optional)

```
php artisan vendor:publish --provider="Sirgrimorum\CrudGenerator\CrudGeneratorServiceProvider" --tag=views
```

### Publish front-end assets

[](#publish-front-end-assets)

```
php artisan crudgen:resources
```

Publishes DataTables, CKEditor, Select2, DateTimePicker, and other JavaScript dependencies to `public/vendor/sirgrimorum/`.

Quick Start
-----------

[](#quick-start)

### 1. Generate a config file for your model

[](#1-generate-a-config-file-for-your-model)

```
php artisan crudgen:createconfig Post
```

This creates `config/sirgrimorum/models/post.php` with all columns pre-filled from the database schema.

### 2. Register the model in the main config

[](#2-register-the-model-in-the-main-config)

```
// config/sirgrimorum/crudgenerator.php
'admin_routes' => [
    'post' => 'config/sirgrimorum/models/post',
],
```

### 3. Access the admin interface

[](#3-access-the-admin-interface)

Navigate to `/{locale}/crud/post` to see the list, create, edit, and delete interface.

Model Configuration
-------------------

[](#model-configuration)

Every feature of the CRUD admin is controlled by a config array. Store it in `config/sirgrimorum/models/modelname.php`.

### Minimal example

[](#minimal-example)

```
use App\Models\Post;

return [
    'modelo' => Post::class,
    'tabla'  => 'posts',
    'nombre' => 'title',    // Field used as the display name
    'id'     => 'id',
    'campos' => [
        'title' => [
            'tipo'  => 'text',
            'label' => 'Title',
        ],
        'body' => [
            'tipo'  => 'html',
            'label' => 'Body',
        ],
        'published_at' => [
            'tipo'  => 'datetime',
            'label' => 'Published At',
        ],
    ],
];
```

### Field type reference

[](#field-type-reference)

TypeDescription`text`Single-line text input`email`Email input with validation`url`URL input`password`Password input (hashed on save)`number`Numeric input with optional format`textarea`Multi-line plain text`html`Rich text via CKEditor`article`Rich text stored in TransArticles table`date`Date picker`datetime`Date + time picker`time`Time picker`select`Dropdown from `opciones` array or callable`checkbox`Checkbox group`radio`Radio button group`relationship`BelongsTo — single related model select`relationships`HasMany/ManyToMany — multi-select list`relationshipssel`ManyToMany with pivot columns and typeahead`file`Single file upload`files`Multiple file upload (JSON array in DB)`color`Color picker`slider`Range slider`json`JSON editor (JSON Editor library)`hidden`Hidden input`function`Read-only computed value (calls model method)### Complete field options

[](#complete-field-options)

```
'status' => [
    'tipo'          => 'select',
    'label'         => 'Status',
    'placeholder'   => 'Choose a status',
    'description'   => 'Shown below the label',
    'help'          => 'Shown below the input',
    'valor'         => 'draft',              // Default value (or callable)
    'opciones'      => [                     // Options for select/checkbox/radio
        'draft'     => 'Draft',
        'published' => 'Published',
        'archived'  => 'Archived',
    ],
    'hide'          => ['list'],             // Hide in these views: create, edit, show, list
    'conditional'   => ['type' => 'post'],  // Only show when 'type' field = 'post'
    'enlace'        => "__route__posts.show,:modelId",  // Wrap list value in a link
    'truncate'      => 100,                  // Truncate text in list view
    'extraClassDiv'   => 'col-md-6',
    'extraClassInput' => 'form-control-sm',
    'tipos_temporales' => [
        'create' => 'hidden',                // Different type when creating
    ],
],

'author_id' => [
    'tipo'     => 'relationship',
    'label'    => 'Author',
    'modelo'   => App\Models\User::class,
    'campo'    => 'name',                   // Display field on related model
    'id'       => 'id',
    'nombre'   => 'name',
    'todos'    => 'all',                    // 'all', callable, or query builder
],

'photo' => [
    'tipo'   => 'file',
    'label'  => 'Photo',
    'path'   => 'uploads/posts/',
    'disk'   => 'public',
    'resize' => [
        'width'   => 800,
        'height'  => 600,
        'path'    => 'uploads/posts/thumbs/',
        'quality' => 85,
    ],
],

'metadata' => [
    'tipo'  => 'json',
    'label' => 'Metadata',
],
```

Rendering Admin Views
---------------------

[](#rendering-admin-views)

Use the static methods anywhere in your own controllers or views:

```
{{-- List with DataTables --}}
{!! CrudGenerator::lists($config, true) !!}

{{-- Create form --}}
{!! CrudGenerator::create($config) !!}

{{-- Edit form --}}
{!! CrudGenerator::edit($config, $id) !!}

{{-- Show (read-only) --}}
{!! CrudGenerator::show($config, $id) !!}
```

Or use the built-in routes at `/{locale}/{admin_prefix}/{model}` (index / create / show / edit / destroy).

Validation
----------

[](#validation)

CrudGenerator reads `$rules` from your model automatically:

```
class Post extends Model
{
    public static $rules = [
        'title' => 'required|string|max:255',
        'body'  => 'required',
        'slug'  => 'required|unique:posts,slug',
    ];
}
```

Custom validation messages via `$error_messages`:

```
public static $error_messages = [
    'title.required' => 'The post title cannot be blank.',
];
```

### Custom validators provided by this package

[](#custom-validators-provided-by-this-package)

RuleDescription`unique_composite:table,col1,col2`Unique across multiple columns`unique_with:table,col1,col2`Alias for composite unique`older_than:18`Minimum age validation for date fields`with_articles:locale1,locale2`All article locales must be filledArtisan Commands
----------------

[](#artisan-commands)

CommandDescription`crudgen:createconfig {Model}`Generate a model config file from DB schema`crudgen:createlang {Model}`Generate a language file for the model`crudgen:createmodel {Model}`Generate an Eloquent model class stub`crudgen:addget {Model}`Add `get($field)` accessor method to model`crudgen:resources`Publish front-end assets (JS/CSS libraries)`crudgen:registererror`Set up error tracking model`crudgen:registermiddleware`Register admin middleware`crudgen:sendalert {title} {message}`Broadcast an alert to the adminAPI Reference
-------------

[](#api-reference)

### `CrudGenerator::lists()`

[](#crudgeneratorlists)

```
CrudGenerator::lists(
    array $config,
    bool  $modales   = false,   // Enable Bootstrap modal buttons
    bool  $simple    = false,   // Minimal render (no JS/CSS includes)
    mixed $registros = null     // Custom Eloquent collection override
): string
```

### `CrudGenerator::create()`

[](#crudgeneratorcreate)

```
CrudGenerator::create(array $config, bool $simple = false, bool $botonModal = false): string
```

### `CrudGenerator::edit()`

[](#crudgeneratoredit)

```
CrudGenerator::edit(
    array $config,
    mixed $id        = null,
    bool  $simple    = false,
    mixed $registro  = null,
    bool  $botonModal = false
): string
```

### `CrudGenerator::show()`

[](#crudgeneratorshow)

```
CrudGenerator::show(array $config, mixed $id = null, bool $simple = false, mixed $registro = null): string
```

### `CrudGenerator::validateModel()`

[](#crudgeneratorvalidatemodel)

```
CrudGenerator::validateModel(array $config, \Illuminate\Http\Request $request): \Illuminate\Validation\Validator|false
```

### `CrudGenerator::saveObjeto()`

[](#crudgeneratorsaveobjeto)

```
CrudGenerator::saveObjeto(array $config, \Illuminate\Http\Request $request, mixed $registro = null): Model
```

Saves (creates or updates) a model instance, handles file uploads, and syncs relationships.

### `CrudGenerator::getConfigWithParametros()`

[](#crudgeneratorgetconfigwithparametros)

```
CrudGenerator::getConfigWithParametros(string $modelo): array
```

Loads the model config, evaluates all `__prefix__` values, and merges request parameters.

Dynamic Value Prefixes
----------------------

[](#dynamic-value-prefixes)

Use these in any config value to have it evaluated at render time:

PrefixResolves to`__route__name``route('name')``__url__/path``url('/path')``__trans__key``trans('key')``__asset__path``asset('path')``__getLocale__``App::getLocale()``__config__key``config('key')``__view__template``view('template')->render()``__transarticle__scope.key`TransArticles contentLicense
-------

[](#license)

The MIT License (MIT). See [LICENSE.md](LICENSE.md).

###  Health Score

55

—

FairBetter than 98% of packages

Maintenance85

Actively maintained with recent releases

Popularity18

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity92

Battle-tested with a long release history

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

Recently: every ~1 days

Total

111

Last Release

75d ago

Major Versions

1.1.0 → 3.2.02018-02-28

PHP version history (3 changes)1.1.0PHP &gt;=7.0

3.8.0PHP ^8.0

3.8.33PHP ^8.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/38ced8f27be30def379c1900bf2a56c7e682180f6a693f17d8168e4e74b8ca82?d=identicon)[sirgrimorum](/maintainers/sirgrimorum)

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/sirgrimorum-crudgenerator/health.svg)

```
[![Health](https://phpackages.com/badges/sirgrimorum-crudgenerator/health.svg)](https://phpackages.com/packages/sirgrimorum-crudgenerator)
```

###  Alternatives

[bagisto/bagisto

Bagisto Laravel E-Commerce

26.2k161.6k7](/packages/bagisto-bagisto)[unopim/unopim

UnoPim Laravel PIM

9.4k1.8k](/packages/unopim-unopim)[october/rain

October Rain Library

1601.7M63](/packages/october-rain)[code16/sharp

Laravel Content Management Framework

78959.5k4](/packages/code16-sharp)[kompo/kompo

Laravel &amp; Vue.js FullStack Components for Rapid Application Development

11812.4k21](/packages/kompo-kompo)

PHPackages © 2026

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