PHPackages                             anwar/crud-generator - 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. [API Development](/categories/api)
4. /
5. anwar/crud-generator

ActiveLibrary[API Development](/categories/api)

anwar/crud-generator
====================

A powerful Laravel package for generating CRUD operations with advanced UI, validation, API generation, and comprehensive testing support. Database-safe with manual migration control.

2.1.0(11mo ago)076MITBladePHP ^8.1CI failing

Since Aug 8Pushed 11mo ago1 watchersCompare

[ Source](https://github.com/ringkubd/anwarcrud)[ Packagist](https://packagist.org/packages/anwar/crud-generator)[ Docs](https://github.com/ringkubd/anwarcrud)[ RSS](/packages/anwar-crud-generator/feed)WikiDiscussions master Synced 2w ago

READMEChangelog (5)Dependencies (7)Versions (6)Used By (0)

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

[](#laravel-crud-generator)

[![Latest Version](https://camo.githubusercontent.com/1c85857f49307af214d2aba3b410785aeb447610d23928c11207bb79b19f3929/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f762f72656c656173652f72696e676b7562642f616e77617263727564)](https://github.com/ringkubd/anwarcrud/releases)[![License](https://camo.githubusercontent.com/9b75c9dfc84f37824bff2071f7c2711cf8308a90adb25e4e68083cad17156d7e/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f72696e676b7562642f616e77617263727564)](LICENSE)[![Total Downloads](https://camo.githubusercontent.com/ef22384c85dbeec6145dfc8ce680323139a01a8c9ef974128b9ca6ee5cdf2e2c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f616e7761722f637275642d67656e657261746f72)](https://packagist.org/packages/anwar/crud-generator)[![Tests](https://github.com/ringkubd/anwarcrud/workflows/Tests/badge.svg)](https://github.com/ringkubd/anwarcrud/actions)

A powerful Laravel package that automates the creation of CRUD operations with advanced features including API generation, comprehensive validation support, and modern UI interface.

🚨 Important Safety Notice
-------------------------

[](#-important-safety-notice)

**⚠️ ALWAYS BACKUP YOUR DATABASE BEFORE INSTALLATION**

This package includes migrations. For your safety:

- Migrations are NOT automatically run
- You must manually publish and review them
- See [SAFETY-NOTICE.md](SAFETY-NOTICE.md) for complete safety guidelines

✨ Features
----------

[](#-features)

- 🚀 **Complete CRUD Generation** - Models, Controllers, Views, Migrations, Requests, Resources
- 🎨 **Modern UI Interface** - Bootstrap 4 with live preview and advanced field configuration
- ✅ **Full Validation Support** - All Laravel validation rules with visual builder
- 🔗 **API Generation** - RESTful controllers and JSON resources
- 📚 **Auto Documentation** - Generate API docs in Markdown and HTML
- ⚡ **CLI Integration** - Artisan commands for automation
- 🧪 **Test Generation** - Feature and unit tests included
- 🎯 **Customizable Templates** - Stub-based system for full customization
- 🛡️ **Database Safe** - No automatic migrations, full user control

📋 Requirements
--------------

[](#-requirements)

- PHP 8.1 or higher
- Laravel 10.0 or higher
- MySQL 5.7+ or PostgreSQL 10+

🚀 Quick Start
-------------

[](#-quick-start)

### Safe Installation

[](#safe-installation)

```
# 1. BACKUP YOUR DATABASE FIRST!
mysqldump -u user -p database_name > backup.sql

# 2. Install the package
composer require anwar/crud-generator

# 3. Publish assets (migrations will NOT auto-run)
php artisan vendor:publish --tag=crudgenerator-config
php artisan vendor:publish --tag=crudgenerator-migrations
php artisan vendor:publish --tag=crudgenerator-assets

# 4. Review published migrations first!
ls database/migrations/*anwar*

# 5. Only run if safe
php artisan migrate
```

### Access the Generator

[](#access-the-generator)

Visit: `http://your-app.com/admin/anwar-crud-generator`

🎯 Usage Examples
----------------

[](#-usage-examples)

### Web Interface

[](#web-interface)

1. **Access the Generator Interface**

    ```
    http://your-app.com/admin/anwar-crud-generator

    ```
2. **Configure Your Module**

    - **Module Name**: `Post`
    - **Fields**:
        - `title` (string, required|max:255)
        - `content` (text, required)
        - `status` (boolean)
        - `published_at` (datetime, nullable)
    - **Relationships**:
        - `user` (belongsTo User)
        - `comments` (hasMany Comment)
    - **Options**: ✓ API, ✓ Soft Deletes
3. **Preview and Generate**

    - Use live preview to review generated code
    - Click "Generate" to create all files

### CLI Commands

[](#cli-commands)

```
# Generate via Artisan
php artisan anwar-crud:generate Post \
  --fields="title:string,content:text,status:boolean" \
  --relationships="user:belongsTo" \
  --api \
  --soft-deletes

# List generated modules
php artisan anwar-crud:list

# Delete module
php artisan anwar-crud:delete Post --force
```

### API Usage

[](#api-usage)

```
# Generate via API
curl -X POST http://your-app.com/api/crud-modules \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-token" \
  -d '{
    "module": "Product",
    "fields": "name:string,price:decimal,description:text",
    "relationships": "category:belongsTo",
    "api": true,
    "softdeletes": false
  }'

# List modules
curl -X GET http://your-app.com/api/crud-modules \
  -H "Authorization: Bearer your-token"
```

📁 Generated Files
-----------------

[](#-generated-files)

When you generate a `Post` module, you'll get:

```
app/
├── Models/Post.php                    # Eloquent model with relationships
├── Http/
│   ├── Controllers/
│   │   ├── PostController.php         # Web controller
│   │   └── Api/PostController.php     # API controller
│   ├── Requests/PostRequest.php       # Form validation
│   └── Resources/PostResource.php     # API resource
resources/views/posts/                 # Bootstrap 4 views
├── index.blade.php                    # List view with DataTables
├── create.blade.php                   # Create form
├── edit.blade.php                     # Edit form
└── show.blade.php                     # Detail view
database/migrations/
└── create_posts_table.php             # Database migration
tests/
├── Feature/PostTest.php               # Feature tests
└── Unit/PostTest.php                  # Unit tests

```

🎨 Advanced Features
-------------------

[](#-advanced-features)

### Field Types &amp; Validation

[](#field-types--validation)

Support for all Laravel field types and validation rules:

```
'fields' => [
    ['name' => 'email', 'type' => 'string', 'validation' => 'required|email|unique:users'],
    ['name' => 'age', 'type' => 'integer', 'validation' => 'required|integer|min:18|max:65'],
    ['name' => 'bio', 'type' => 'text', 'validation' => 'nullable|string|max:1000'],
    ['name' => 'avatar', 'type' => 'string', 'validation' => 'nullable|image|max:2048'],
    ['name' => 'settings', 'type' => 'json', 'validation' => 'nullable|array'],
    ['name' => 'salary', 'type' => 'decimal', 'validation' => 'required|numeric|min:0'],
]
```

### Complex Relationships

[](#complex-relationships)

```
'relationships' => [
    [
        'name' => 'user',
        'type' => 'belongsTo',
        'model' => 'User',
        'foreign_key' => 'user_id'
    ],
    [
        'name' => 'tags',
        'type' => 'belongsToMany',
        'model' => 'Tag',
        'pivot_table' => 'post_tags'
    ]
]
```

### API Features

[](#api-features)

Generated API controllers include:

- ✅ RESTful endpoints (GET, POST, PUT, DELETE)
- ✅ JSON API resources with data transformation
- ✅ Proper HTTP status codes
- ✅ Error handling and validation
- ✅ Pagination support
- ✅ Rate limiting ready

Example API endpoints:

```
GET    /api/posts           # List all posts
POST   /api/posts           # Create new post
GET    /api/posts/{id}      # Get specific post
PUT    /api/posts/{id}      # Update post
DELETE /api/posts/{id}      # Delete post

```

🔧 Configuration
---------------

[](#-configuration)

Customize the package behavior in `config/anwarcrud.php`:

```
return [
    'model_namespace' => 'App\\Models',
    'controller_namespace' => 'App\\Http\\Controllers',
    'view_path' => 'resources/views',

    'features' => [
        'api_generation' => true,
        'test_generation' => true,
        'documentation_generation' => true,
        'soft_deletes' => true,
    ],

    'ui' => [
        'theme' => 'bootstrap4',
        'show_preview' => true,
        'enable_live_preview' => true,
    ],
];
```

🎯 Customization
---------------

[](#-customization)

### Custom Templates

[](#custom-templates)

1. Publish stubs:

    ```
    php artisan vendor:publish --tag=anwar-crud-stubs
    ```
2. Modify templates in `resources/crud-stubs/`
3. Use custom placeholders:

    - `@modelName` - Model class name
    - `@modelVar` - Model variable name
    - `@fields` - Generated fields
    - `@relationships` - Generated relationships

### Custom Field Types

[](#custom-field-types)

Add custom field types:

```
'custom_fields' => [
    'phone' => [
        'migration_type' => 'string',
        'validation' => 'required|string|regex:/^[0-9\-\+\s\(\)]+$/',
        'input_type' => 'tel'
    ]
]
```

🧪 Testing
---------

[](#-testing)

Run package tests:

```
vendor/bin/phpunit packages/CrudGenerator/tests/
```

Generated modules include comprehensive tests:

```
// Feature Test Example
public function test_can_create_post()
{
    $data = ['title' => 'Test Post', 'content' => 'Test Content'];

    $response = $this->post(route('posts.store'), $data);

    $response->assertRedirect(route('posts.index'));
    $this->assertDatabaseHas('posts', $data);
}

// API Test Example
public function test_api_can_list_posts()
{
    Post::factory(3)->create();

    $response = $this->getJson('/api/posts');

    $response->assertOk()
             ->assertJsonCount(3, 'data');
}
```

📖 Documentation
---------------

[](#-documentation)

- **Full Documentation**: [DOCUMENTATION.md](DOCUMENTATION.md)
- **API Reference**: Complete API documentation with examples
- **Video Tutorials**: \[Coming Soon\]
- **Wiki**: [GitHub Wiki](https://github.com/ringkubd/anwarcrud/wiki)

🤝 Contributing
--------------

[](#-contributing)

We welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for details.

### Development Setup

[](#development-setup)

```
git clone https://github.com/ringkubd/crud-generator.git
cd crud-generator
composer install
cp .env.example .env.testing
php artisan key:generate --env=testing
vendor/bin/phpunit
```

🐛 Bug Reports &amp; Feature Requests
------------------------------------

[](#-bug-reports--feature-requests)

Please use [GitHub Issues](https://github.com/ringkubd/anwarcrud/issues) for:

- 🐛 Bug reports
- 💡 Feature requests
- 📝 Documentation improvements
- ❓ Questions and support

📄 License
---------

[](#-license)

This package is open-source software licensed under the [MIT License](LICENSE).

🙏 Credits
---------

[](#-credits)

- **Author**: [Anwar Jahid](https://anwarjahid.com) |
- **Contributors**: [All Contributors](https://github.com/ringkubd/anwarcrud/contributors)
- **Inspired by**: Laravel community and best practices

🔗 Links
-------

[](#-links)

- **Packagist**: [anwar/crud-generator](https://packagist.org/packages/anwar/crud-generator)
- **GitHub**: [ringkubd/anwarcrud](https://github.com/ringkubd/anwarcrud)
- **Issues**: [Report Issues](https://github.com/ringkubd/anwarcrud/issues)
- **Discussions**: [GitHub Discussions](https://github.com/ringkubd/anwarcrud/discussions)

---

⭐ **Star this repo** if you find it useful!

*Made with ❤️ for the Laravel community*

###  Health Score

38

—

LowBetter than 83% of packages

Maintenance50

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Total

5

Last Release

356d ago

Major Versions

0.0.3 → 2.0.02025-07-08

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b1333bbd2f796d53001d6dfbc3327f4c5ae72bca1a67fd4f32ee7375a538004?d=identicon)[ringkubd](/maintainers/ringkubd)

---

Top Contributors

[![ringkubd](https://avatars.githubusercontent.com/u/20917263?v=4)](https://github.com/ringkubd "ringkubd (37 commits)")

---

Tags

apilaravelvalidationgeneratorscaffoldcrudbootstrapadmindatabase-safeno-auto-migrate

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/anwar-crud-generator/health.svg)

```
[![Health](https://phpackages.com/badges/anwar-crud-generator/health.svg)](https://phpackages.com/packages/anwar-crud-generator)
```

###  Alternatives

[psalm/plugin-laravel

Psalm plugin for Laravel

3345.1M337](/packages/psalm-plugin-laravel)[laravel/cashier

Laravel Cashier provides an expressive, fluent interface to Stripe's subscription billing services.

2.5k28.4M137](/packages/laravel-cashier)[laravel/pulse

Laravel Pulse is a real-time application performance monitoring tool and dashboard for your Laravel application.

1.7k14.1M123](/packages/laravel-pulse)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9772.3M122](/packages/roots-acorn)[api-platform/laravel

API Platform support for Laravel

59156.3k11](/packages/api-platform-laravel)

PHPackages © 2026

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