PHPackages                             digitaldream/laracrud - 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. digitaldream/laracrud

ActiveLibrary[Admin Panels](/categories/admin)

digitaldream/laracrud
=====================

Do you have a well structured database and you want to make a Laravel Application on top of it. By using this tools you can generate Models which have necessary methods and property, Request class with rules, generate route from controllers method and its parameter and full features form with validation error message and more with a single line of command

5.0.1(1y ago)33221.3k↓50%53[6 issues](https://github.com/digitaldreams/laracrud/issues)MITPHPPHP ^8.0CI failing

Since Sep 6Pushed 1y ago20 watchersCompare

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

READMEChangelog (10)Dependencies (2)Versions (45)Used By (0)

Laravel Code Generator
======================

[](#laravel-code-generator)

Do you have a well structed database and you want to make a Laravel Application on top of it. By using this tools you can generate Models which have necessary methods and property, Request class with rules, generate route from controllers method and its parameter and full features form with validation error message and more with a single line of command. So lets start. [See demo](https://github.com/digitaldreams/laracrud-demo) code and [slides](https://slides.com/tuhinbepari/laracrud/fullscreen#/)

### Installation

[](#installation)

```
composer require digitaldream/laracrud --dev

```

Setting
-------

[](#setting)

1. Add this line to config/app.php providers array . Not needed if you are using laravel 5.5 or greater

```
    LaraCrud\LaraCrudServiceProvider::class
```

2. Then Run

```
    php artisan vendor:publish --provider="LaraCrud\LaraCrudServiceProvider"
```

Commands
--------

[](#commands)

Then you can see new commands by running 'php artisan'

- `laracrud:model {tableName} {name?} {--on=} {--off=}`: Create model based on table
- `laracrud:request {Model} {name?} {--resource=} {--controller=} {--api}`: Create Request Class/es based on table
- `laracrud:Controller {Model} {name?} {--parent=} {--only=} {--api}`: Create Controller Class based on Model
- `laracrud:mvc {table} {--api}`: Run above commands into one place
- `laracrud:route {controller} {--api}`: Create routes based on controller method
- `laracrud:view {Model} {--page=(index|create|edit|show|form|table|panel|modal)} {--type=} {--name=} {--controller=}`
- `laracrud:migration {table}`: Create a migration file based on Table structure. Its opposite of normal migration file creation in Laravel
- `laracrud:policy {model} {--controller=} {--name=}`
- `laracrud:package {--name=}`
- `laracrud:transformer {model} {name?}`: Create a dingo api transformer for a model
- `laracrud:test {controller} {--api}`: Create test methods for each of the method of a controller

**N.B: --api option will generate api resource. Like Controller, Request, Route, Test. [Dingo API](https://github.com/dingo/api) compatible code will be generated**. [See API documentation](https://github.com/digitaldreams/laracrud/wiki/API-Development)

### How to Use

[](#how-to-use)

Create a Model
--------------

[](#create-a-model)

There are some good practice for model in Laravel. Use scope to define query, define fillable, dates, casts etc. Also define relation, set*Attribute and get*Attribute for doing work before and after model save and fetch.

We are going to create this thing automatically by reading table structure and its relation to others table.

```
    php artisan laracrud:model users
```

By default Model Name will be based on Table name. But Model name can be specified as second parameter. Like below

```
php artisan laracrud:model users MyUser
```

[Video Tutorial](https://www.youtube.com/watch?v=TDfsdkPHKf4&list=PLcGdsjZbEjRtxROY7mlHcJQcSwxx9L8NB)

Create Request
--------------

[](#create-request)

A well structured table validate everything before inserting . You can not insert a illegal date in a birth\_date column if its data type set to date.So if we have this logic set on table why we should write it on Request again. Lets use this table logic to create a request class in laravel.

```
php artisan laracrud:request MyUser

```

Here **MyUser** is Eloquent Model. From LaraCrud version 4.\* this command accept Model Name instead of Table

Like Model Name we can also specify a custom request name.

```
php artisan laracrud:request User RegisterRequest
```

Also If you like to create multiple request for your resourceful controller then

```
php artisan laracrud:request User –-resource=index,show,create,update,destroy
```

It will create a folder users on app/Http/Requests folder and create these request classes. Sometimes you may like to create individual request class for each of your controller method then.

```
php artisan laracrud:request User –-controller=UserController
php artisan laracrud:request User --controller=UserController --api //this will generated Request for API usages
```

It will read your controller and create request classes for your Public method

[video tutorial](https://www.youtube.com/watch?v=MGMP9FB2l5g&index=2&list=PLcGdsjZbEjRtxROY7mlHcJQcSwxx9L8NB)

Create Controller
-----------------

[](#create-controller)

```
    php artisan laracrud:controller User
    //Or Give a controller name.
    php artisan laracrud:controller User MyUserController
    //Or we can give a sub namespace
    php artisan laracrud:controller User User/UserController
    //It will create a folder User to controllers
    php artisan laracrud:controller Comment --parent=Post // it will create a sub resource CommentController
```

This will create a controller which have create, edit, save and delete method with codes . It also handle your relation syncronization

[video tutorial](https://youtu.be/MGMP9FB2l5g?t=5m10s)

Create View
-----------

[](#create-view)

A typical form represent a database table. E.g. for a Registration form it has all the input field which is necessary for users table. Most of the time we use Bootstrap to generate a form . It has error field highlighting if validation fails. Also display value. This all can be done by

```
 php artisan laracrud:view User --page=form
 php artisan laracrud:view User --page=index --type=panel //There are three type of layout for index page panel,table and tabpan
 php artisan laracrud:view User --controller=UserController // Create all the views which is not created yet for this controller

```

Here **User** is Eloquent Model. From LaraCrud version 4.\* this command accept Model Name instead of Table

This will create a complete users crud view.

[video tutorial](https://www.youtube.com/watch?v=RjRFWABwXnA&list=PLcGdsjZbEjRtxROY7mlHcJQcSwxx9L8NB&index=5)

Create Route
------------

[](#create-route)

Routes are the most vital part of a laravel application. WE create routes by its public methods and parameter. Lets do this work to rotue command.

```
    php artisan laracrud:route UserController
    php artisan laracrud:route UserController --api // generate api routes for this conroller
```

If you have some routes already redine for then do not worry. It will create routes for which does not define yet. Please use forward slash(/) for sub namespace. For example,

```
 php artisan laracrud:route Auth/AuthController
```

Policy
------

[](#policy)

Laravel have default policy generator. It works like same with one extra feature that is create policy method based on controller public methods.

```
php artisan laracrud:policy User
// will create policy class with basic methods
php artisan laracrud:policy User --controller=UserController
// create method based on Controller public methods
```

Package
-------

[](#package)

Packages gives us opportunity to create/use components into our existing application. That make our code reusable. Laravel package has similar structure as a Laravel application has.

```
php artisan laracrud:package Hello
```

This will create a folder same structure as a Laravel application has into your /packages folder [See Package documentation](https://github.com/digitaldreams/laracrud/wiki/Package-Development)[Video tutorial](https://www.youtube.com/watch?v=7-mhRjKQPuY&t=2s)

Test
----

[](#test)

We need to test our routes endpoints. To create test class based on a controller do the following

```
php artisan laracrud:test UserController
// or to make api test just pass --api like below
php artisan laracrud:test UserController --api
```

Transformer
-----------

[](#transformer)

Transformer are a vital part of Dingo API. To expose a model to api endpoint Transformer play media between api and model.

```
php artisan laracrud:transformer User
```

[See API documentation](https://github.com/digitaldreams/laracrud/wiki/API-Development)

Create everything at once
-------------------------

[](#create-everything-at-once)

If we need all the command to then just to

```
    php artisan laracrud:mvc users
    php artisan laracrud:mvc users --api // create all the API related resources
```

It will create Model, Request, Controller, View. Then you just need to run route command to create routes.

Migration
---------

[](#migration)

Somethings we may need to create a migration file from a table. Then this command will be useful. It will generate all the necessary code for your migration files. So your migration file is ready to use.

```
php artisan laracrud:migration users
```

Customize Code Template
-----------------------

[](#customize-code-template)

Coding Style differ from developer to developer. So you can control how your code will be generated. Code templates are organized by folder in resources/vendor/laracrud/templates . Go there and change the style. After that your code will be generated by reading these files. *Please do not remove or change @@placeHolder@@. This will be replaced by application*.

NB: only for mysql database
===========================

[](#nb-only-for-mysql-database)

It is recommended to take a look in the generated file before use it.

Like my work? If so [hire me on upwork](https://www.upwork.com/fl/tuhinbepari)

###  Health Score

51

—

FairBetter than 96% of packages

Maintenance39

Infrequent updates — may be unmaintained

Popularity45

Moderate usage in the ecosystem

Community21

Small or concentrated contributor base

Maturity81

Battle-tested with a long release history

 Bus Factor1

Top contributor holds 99.2% 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 ~77 days

Recently: every ~530 days

Total

40

Last Release

518d ago

Major Versions

1.1.3 → 2.02017-10-11

2.1.4 → 3.0.02018-01-31

3.4.1 → 4.0.02019-09-13

4.0.1 → 5.02021-09-24

PHP version history (4 changes)1.0.0PHP &gt;=5.5.0

1.0.1PHP &gt;=5.5.9

4.0.0PHP &gt;=7.0.0

5.0PHP ^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/6059541?v=4)[Tuhin Bepari](/maintainers/digitaldreams)[@digitaldreams](https://github.com/digitaldreams)

---

Top Contributors

[![digitaldreams](https://avatars.githubusercontent.com/u/6059541?v=4)](https://github.com/digitaldreams "digitaldreams (363 commits)")[![zhouyixiang](https://avatars.githubusercontent.com/u/2133075?v=4)](https://github.com/zhouyixiang "zhouyixiang (2 commits)")[![rap2hpoutre](https://avatars.githubusercontent.com/u/1575946?v=4)](https://github.com/rap2hpoutre "rap2hpoutre (1 commits)")

---

Tags

code-generatorcrud-generatorlaracrudlaravellaravel-5-packagelaravel-applicationlaravel-crudlaravel-frameworkphplaravelcode generatorcrudlaravel code generator

### Embed Badge

![Health badge](/badges/digitaldream-laracrud/health.svg)

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

###  Alternatives

[crestapps/laravel-code-generator

An intelligent code generator for Laravel framework that will save you time! This awesome tool will help you generate resources like views, controllers, routes, migrations, languages and/or form-requests! It is extremely flexible and customizable to cover many on the use cases. It is shipped with cross-browsers compatible template, along with a client-side validation to modernize your application.

76591.7k1](/packages/crestapps-laravel-code-generator)[takielias/tablar-crud-generator

Laravel Tablar Crud Generator based on https://github.com/takielias/tablar

315.6k](/packages/takielias-tablar-crud-generator)

PHPackages © 2026

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