PHPackages                             devalade/crudify - 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. devalade/crudify

ActiveLibrary[Framework](/categories/framework)

devalade/crudify
================

Generate full CRUD with Livewire v4 components in Laravel

1.5.7(1mo ago)4772[12 issues](https://github.com/devalade/crudify/issues)MITPHPPHP ^8.2CI passing

Since Apr 20Pushed 1mo agoCompare

[ Source](https://github.com/devalade/crudify)[ Packagist](https://packagist.org/packages/devalade/crudify)[ RSS](/packages/devalade-crudify/feed)WikiDiscussions main Synced 1w ago

READMEChangelog (10)Dependencies (8)Versions (26)Used By (0)

Crudify
=======

[](#crudify)

[![Tests](https://github.com/devalade/crudify/actions/workflows/tests.yml/badge.svg)](https://github.com/devalade/crudify/actions/workflows/tests.yml)

Generate full CRUD scaffolding for Laravel with a single command. Built for **Livewire v4** and **Laravel 11/12/13**.

Crudify creates models, migrations, policies, Volt or Livewire CRUD pages, factories, and seeders — with support for relationships, soft deletes, file uploads, and searchable fields.

---

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

[](#installation)

```
composer require devalade/crudify --dev
```

---

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

[](#quick-start)

### CLI

[](#cli)

```
php artisan crudify:generate Post \
  --fields="title:string|body:text|is_published:boolean|published_at:datetime" \
  --relationships="user:belongsTo:User|category:belongsTo:Category|tags:belongsToMany:Tag" \
  --soft-delete
```

Volt single-file components are generated by default.

This generates SFCs directly in `resources/views/pages/posts/`:

- `index.blade.php` — list with search, sort, pagination
- `create.blade.php` — inline validation with `#[Validate]`
- `edit.blade.php` — edit form with file upload support
- `show.blade.php` — detail view

Routes are auto-discovered and registered by Crudify's service provider.

### Classic Livewire

[](#classic-livewire)

Generate classic Livewire page classes, Blade views, controllers, form requests, and routes:

```
php artisan crudify:generate Post \
  --fields="title:string|body:text|is_published:boolean" \
  --livewire
```

### YAML

[](#yaml)

```
php artisan crudify:generate --file=post.yaml
```

**`post.yaml`**

```
model: Post

fields:
  title:
    type: string
    nullable: false
    unique: true

  slug:
    type: string
    nullable: false
    unique: true
    index: true

  body:
    type: text
    nullable: false

  is_published:
    type: boolean
    default: false

  published_at:
    type: datetime
    nullable: true

  # Single image upload
  featured_image:
    type: image
    nullable: true

  # Multiple file uploads
  gallery:
    type: image
    multiple: true
    nullable: true

  # Single file upload
  attachment:
    type: file
    nullable: true

relationships:
  user:
    type: belongsTo
    model: User

  category:
    type: belongsTo
    model: Category

  tags:
    type: belongsToMany
    model: Tag

  comments:
    type: hasMany
    model: Comment

searchable:
  - title
  - body

options:
  soft_deletes: true
  volt: true
```

Then run:

```
php artisan migrate
```

Visit `/{resource}` (e.g. `/posts`).

---

Field Syntax
------------

[](#field-syntax)

### CLI Format

[](#cli-format)

```
name:type:modifier1:modifier2

```

**Examples:**

Field DefinitionResult`title:string``string` column`body:text``text` column`email:string:unique``string` with unique index`published_at:datetime:nullable`nullable `datetime``status:string:default:draft``string` with default value`user_id:foreign:users``foreignId` constrained to `users` table`views:integer:index``integer` with index`photo:image``string` column + file upload input`documents:file:multiple``json` column + multiple file upload input### Available Types

[](#available-types)

`string`, `text`, `integer`, `bigint`, `float`, `double`, `decimal`, `boolean`, `date`, `datetime`, `timestamp`, `time`, `json`, `uuid`, `email`, `foreign`, `image`, `file`

### Modifiers

[](#modifiers)

- `nullable` — allows NULL values
- `unique` — adds unique constraint
- `index` — adds database index
- `default:value` — sets default value
- `foreign:table` — creates foreign key constraint
- `multiple` — enables multiple file uploads (for `image` and `file` types)

---

File Uploads
------------

[](#file-uploads)

Crudify supports single and multiple file/image uploads out of the box — for both Volt SFCs and classic Livewire pages.

### Single Upload

[](#single-upload)

```
php artisan crudify:generate Product \
  --fields="name:string|price:decimal|photo:image"
```

Generates:

- `string` column for the file path
- `WithFileUploads` trait in Volt components
- File input with `accept="image/*"`
- Automatic file storage to `storage/app/public/`
- Old file deletion on edit

### Multiple Uploads

[](#multiple-uploads)

```
php artisan crudify:generate Gallery \
  --fields="title:string|photos:image:multiple"
```

Generates:

- `json` column for storing multiple paths
- Array-cast in the model
- Multiple file input (``)
- `removePhotosFile()` method for selective removal
- Gallery preview grid on edit/show views

---

Relationships
-------------

[](#relationships)

Define Eloquent relationships in your model with a simple syntax.

### CLI

[](#cli-1)

```
php artisan crudify:generate Post \
  --fields="title:string|user_id:foreign:users" \
  --relationships="user:belongsTo:User|category:belongsTo:Category|tags:belongsToMany:Tag|comments:hasMany:Comment"
```

### YAML

[](#yaml-1)

```
relationships:
  author:
    type: belongsTo
    model: User
    display: email
    label: Author
  comments:
    type: hasMany
    model: Comment
  profile:
    type: hasOne
    model: Profile
  tags:
    type: belongsToMany
    model: Tag
    display: slug
    label: Topics
```

### Supported Types

[](#supported-types)

- `belongsTo` — generates dropdown in forms, eager-loaded in index
- `hasMany` — generates model method only
- `hasOne` — generates model method only
- `belongsToMany` — generates checkbox group in forms, syncs on save

Relationships are automatically:

- Added to the model with proper return types
- Eager-loaded in generated index components
- Validated in generated forms for classic Livewire mode
- Displayed in index tables and show views
- For `belongsToMany`, generates pivot migration and missing related model when needed

### Relationship Display API

[](#relationship-display-api)

Use optional relationship metadata when default `name` field is not right.

**CLI**

```
php artisan crudify:generate Post \
  --fields="title:string" \
  --relationships="author:belongsTo:User:email|tags:belongsToMany:Tag:slug"
```

CLI format:

```
name:type:model[:display]

```

**YAML**

```
relationships:
  author:
    type: belongsTo
    model: User
    display: email
    label: Author

  tags:
    type: belongsToMany
    model: Tag
    display: slug
    label: Topics
```

Behavior:

- `display` chooses field used in selects, checkbox labels, index badges, and show pages
- `label` overrides section/table/form label shown to end users
- `belongsToMany` appears in create/edit as checkboxes and in index/show as badges by default

### belongsToMany Example

[](#belongstomany-example)

For a `tags:belongsToMany:Tag` relationship, the generator produces:

**YAML:**

```
model: Post

fields:
  title: string
  body: text

relationships:
  tags:
    type: belongsToMany
    model: Tag
    display: slug
    label: Topics
```

Run:

```
php artisan crudify:generate --file=post.yaml
```

Generated artifacts in default Volt mode:

- `app/Models/Post.php`
- `app/Models/Tag.php` if missing
- `database/migrations/*_create_posts_table.php`
- `database/migrations/*_create_post_tag_table.php`
- Volt create/edit checkbox UI
- index badges for related tags
- `selectedTagsIds` state and sync logic

---

Generated Files
---------------

[](#generated-files)

For a model named `Post`, Crudify generates by default:

FileDescription`app/Models/Post.php`Eloquent model with `$fillable`, `$casts`, traits, and relationships`database/factories/PostFactory.php`Factory with Faker methods mapped to field types`database/seeders/PostSeeder.php`Seeder calling `Post::factory()->count(10)->create()``database/migrations/xxxx_create_posts_table.php`Migration with all columns and indexes`app/Policies/PostPolicy.php`Authorization policy`resources/views/pages/posts/index.blade.php`Volt index page with search, sort, pagination`resources/views/pages/posts/create.blade.php`Volt create page with inline validation`resources/views/pages/posts/edit.blade.php`Volt edit page`resources/views/pages/posts/show.blade.php`Volt show pageUse `--livewire` to generate classic extras instead:

- `app/Http/Controllers/PostsController.php`
- `app/Http/Requests/StorePostRequest.php`
- `app/Http/Requests/UpdatePostRequest.php`
- `app/Livewire/Pages/Posts/*.php`
- `resources/views/livewire/pages/posts/*.blade.php`
- `routes/web.php`

### Livewire 4 Compatible

[](#livewire-4-compatible)

All generated components use Livewire 4 syntax:

- `#[Validate]` attributes on properties (fixes `MissingRulesException`)
- `#[Layout]` and `#[Title]` attributes
- `WithFileUploads` trait for file handling
- `wire:confirm` for delete confirmations

---

UI Framework
------------

[](#ui-framework)

Generated views use **Flux UI components** with **Tailwind CSS**. Generated Blade files include `flux:*` components plus Tailwind utility classes:

```

  ...

```

Install Flux in generated app:

```
composer require livewire/flux

@fluxAppearance
@vite(['resources/css/app.css', 'resources/js/app.js'])
@fluxScripts
```

Bootstrap setup files with:

```
php artisan crudify:setup
```

This command:

- creates `resources/css/app.css` with Tailwind + Flux imports
- creates `resources/js/app.js`
- creates or patches common app layouts with `@fluxAppearance`, `@vite(...)`, `@livewireScripts`, and `@fluxScripts`
- patches Vite config to add `@tailwindcss/vite` when a Vite config file exists

Install and bootstrap everything automatically:

```
php artisan crudify:install
php artisan crudify:install --volt
```

`crudify:install`:

- installs `livewire/flux`
- installs `livewire/volt` when `--volt` used
- installs `tailwindcss` and `@tailwindcss/vite` via npm when `package.json` exists
- runs `crudify:setup`

---

Command Options
---------------

[](#command-options)

```
php artisan crudify:generate {model}
  --fields=          # Field definitions, separated by `|` or `;`
  --file=            # Path to YAML file (overrides --fields)
  --relationships=   # Relationships, separated by `|` or `;`
  --only=            # Generate only specific types (`model|migration` etc.)
  --skip=            # Skip specific types (`controller;policy` etc.)
  --soft-delete      # Add soft deletes
  --searchable=      # Comma-separated searchable fields
  --volt             # Explicitly generate Volt single-file components (default)
  --livewire         # Generate classic Livewire pages + controllers + requests + routes
  --force            # Overwrite existing files
  --dry-run          # Preview without writing files
```

### Examples

[](#examples)

**Generate with file uploads:**

```
php artisan crudify:generate Product \
  --fields="name:string|price:decimal|photo:image"
```

**Generate with relationships:**

```
php artisan crudify:generate Post \
  --fields="title:string|body:text" \
  --relationships="user:belongsTo:User|tags:belongsToMany:Tag"
```

**Generate classic Livewire instead of Volt:**

```
php artisan crudify:generate Post \
  --fields="title:string|body:text" \
  --livewire
```

**Generate only model and migration:**

```
php artisan crudify:generate Post --fields="title:string" --only=model|migration
```

**Skip controllers (Livewire-only):**

```
php artisan crudify:generate Post --fields="title:string" --skip=controller
```

**Preview changes:**

```
php artisan crudify:generate Post --fields="title:string" --dry-run
```

---

Customizing Stubs
-----------------

[](#customizing-stubs)

Publish stubs to your application:

```
php artisan crudify:stubs
```

Then edit files in `stubs/crudify/`. The package will use your custom stubs on the next generation.

---

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

[](#requirements)

- PHP ^8.2
- Laravel ^11.0, ^12.0 or ^13.0
- Livewire ^4.0

---

Testing
-------

[](#testing)

```
composer test          # Run all tests
composer test:unit     # Run unit tests only
composer test:feature  # Run feature tests only
composer analyse       # Run static analysis
composer format        # Fix code style
```

---

License
-------

[](#license)

MIT

###  Health Score

41

—

FairBetter than 87% of packages

Maintenance72

Regular maintenance activity

Popularity18

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

25

Last Release

39d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/0eb31a7187875ed62d497c27f2faf5f25c4bcc7098a57e254fb8e2d36b8a93b3?d=identicon)[devalade](/maintainers/devalade)

---

Top Contributors

[![devalade](https://avatars.githubusercontent.com/u/74435372?v=4)](https://github.com/devalade "devalade (63 commits)")

###  Code Quality

TestsPest

Static AnalysisPHPStan

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

![Health badge](/badges/devalade-crudify/health.svg)

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

###  Alternatives

[nasirkhan/laravel-starter

A CMS like modular Laravel starter project.

1.4k2.7k](/packages/nasirkhan-laravel-starter)[tempest/framework

The PHP framework that gets out of your way.

2.2k31.1k11](/packages/tempest-framework)

PHPackages © 2026

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