PHPackages                             mrmarchone/laravel-auto-crud - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. mrmarchone/laravel-auto-crud

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

mrmarchone/laravel-auto-crud
============================

Laravel Auto CRUD helps you streamline development and save time.

v1.7.0(2mo ago)28711.8k—4.8%25[1 issues](https://github.com/mrmarchone/laravel-auto-crud/issues)2MITPHPPHP &gt;=8.1

Since Feb 10Pushed 2mo ago3 watchersCompare

[ Source](https://github.com/mrmarchone/laravel-auto-crud)[ Packagist](https://packagist.org/packages/mrmarchone/laravel-auto-crud)[ Fund](https://www.buymeacoffee.com/mrmarchone)[ GitHub Sponsors](https://github.com/mrmarchone)[ RSS](/packages/mrmarchone-laravel-auto-crud/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (14)Versions (14)Used By (2)

Laravel Auto CRUD Generator
===========================

[](#laravel-auto-crud-generator)

[![Laravel Auto CRUD](images/laravel-auto-crud.png)](images/laravel-auto-crud.png)

[![Total Downloads](https://camo.githubusercontent.com/49dba744071472cc4efb8dd13d2d0dca7bc5577f4e7211d188d028452bc42b9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)](https://camo.githubusercontent.com/49dba744071472cc4efb8dd13d2d0dca7bc5577f4e7211d188d028452bc42b9d/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)[![Monthly Downloads](https://camo.githubusercontent.com/8f244da8765f6f0fe03a54b4961ffb29f2a976a9155f5a2eccc791a341a1fc9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)](https://camo.githubusercontent.com/8f244da8765f6f0fe03a54b4961ffb29f2a976a9155f5a2eccc791a341a1fc9e/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f646d2f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)[![Daily Downloads](https://camo.githubusercontent.com/6d357af51b12fcff756ad5e7687a760a4f995a620343c06a1ef8f640e5144a78/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)](https://camo.githubusercontent.com/6d357af51b12fcff756ad5e7687a760a4f995a620343c06a1ef8f640e5144a78/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64642f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)[![Packagist Stars](https://camo.githubusercontent.com/57d42736f5928820e30f83bf71782447bfda1e280911e36cd8b99bd328515d07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)](https://camo.githubusercontent.com/57d42736f5928820e30f83bf71782447bfda1e280911e36cd8b99bd328515d07/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f73746172732f6d726d617263686f6e652f6c61726176656c2d6175746f2d63727564)

Laravel Auto CRUD Generator is a package that simplifies CRUD (Create, Read, Update, Delete) operations for your Laravel application. With a single command, you can generate all necessary files and logic for a selected model, reducing development time and effort.

[Watch the Video on YouTube](https://www.youtube.com/watch?v=6IqRc3OgUIM)

Features
--------

[](#features)

- Automatically detects models in the app/Models folder.
- Provides an interactive CLI to select a model.
- Generates controller, request validation, routes, views, and more.
- Follows Laravel's best practices for clean and maintainable code.

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

[](#installation)

You can install the package via Composer:

```
composer require mrmarchone/laravel-auto-crud --dev
```

Publish Configuration
---------------------

[](#publish-configuration)

You can publish the configuration file via:

```
php artisan vendor:publish --provider="Mrmarchone\LaravelAutoCrud\LaravelAutoCrudServiceProvider" --tag="auto-crud-config"
```

Usage
-----

[](#usage)

To generate CRUD operations for a model, use the following Artisan command:

```
php artisan auto-crud:generate -h
```

```
Description:
  A command to create auto CRUD for your models.

Usage:
  auto-crud:generate [options]

Options:
  -A, --all                       Force generate all possible files without overwrite option.
  -M, --model[=MODEL]             Select one or more of your models. (multiple values allowed)
  -T, --type[=TYPE]               Select api, web or both. (multiple values allowed)
  -R, --repository                Working with repository design pattern.
  -O, --overwrite                 Overwrite the files if already exists.
  -P, --pattern[=PATTERN]         Supports Spatie-Data Pattern. [default: "normal"]
  -C, --curl                      Generate CURL Requests for API.
  -S, --swagger-api               Generate Swagger API json for API.
  -h, --help                      Display help for the given command. When no command is given display help for the list command
      --silent                    Do not output any message
  -q, --quiet                     Only errors are displayed. All other output is suppressed
  -V, --version                   Display this application version
      --ansi|--no-ansi            Force (or disable --no-ansi) ANSI output
  -n, --no-interaction            Do not ask any interactive question
      --env[=ENV]                 The environment the command should run under
  -FA, --force-all                Force generate all possible files with overwrite option.
  -MP, --model-path[=MODEL-PATH]  Set models path.
  -PM, --postman                  Generate Postman Collection for API.
  -v|vv|vvv, --verbose            Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug

```

> ⚠️ **Warning**
> Take care when you create a models outside app directory, because command will generate the folder structure in all folders like Controllers, Resources, Requests, etc.
> Example (Models Path) =&gt; AnotherModels/Models , this will generate files like this one app/Http/Controllers/AnotherModels/Models/ModelController.php

### Example:

[](#example)

```
php artisan auto-crud:generate --model-path=app/AnotherModels --model=User --model=Manager --overwrite --type=api --repository --pattern=spatie-data --curl --postman
```

[![Views](images/command.png)](images/command.png)

This will generate:

- API Controller:

```
