PHPackages                             swattech/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. [Database &amp; ORM](/categories/database)
4. /
5. swattech/crud

ActiveLibrary[Database &amp; ORM](/categories/database)

swattech/crud
=============

Enterprise-grade Crud generator for Laravel 12 with theme integration

v1.0.0(1y ago)05MITPHPPHP ^8.1|^8.2|^8.3CI failing

Since Mar 7Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Swatinfo/swattechcrud)[ Packagist](https://packagist.org/packages/swattech/crud)[ RSS](/packages/swattech-crud/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (1)Dependencies (30)Versions (3)Used By (0)

SwatTech CRUD for Laravel 12
============================

[](#swattech-crud-for-laravel-12)

[![Version](https://camo.githubusercontent.com/444318da9488a8fdb26d29bf16aab730eb4bc522ecbb75e92aaad60cafb6167c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73776174746563682f637275642e737667)](https://camo.githubusercontent.com/444318da9488a8fdb26d29bf16aab730eb4bc522ecbb75e92aaad60cafb6167c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f73776174746563682f637275642e737667)[![PHP](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)](https://camo.githubusercontent.com/83dd395020c37276225039739320f6c8e7e99963ab21ee3d09282cb48dad2a60/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f5048502d382e312532422d626c7565)[![Laravel](https://camo.githubusercontent.com/5b99ec644e12357132ddb95970822afd67efedef92fcccb6270926adebd8b101/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e782d726564)](https://camo.githubusercontent.com/5b99ec644e12357132ddb95970822afd67efedef92fcccb6270926adebd8b101/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c61726176656c2d31322e782d726564)[![License](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)](https://camo.githubusercontent.com/f8df3091bbe1149f398a5369b2c39e896766f9f6efba3477c63e9b4aa940ef14/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d677265656e)[![Tests](https://camo.githubusercontent.com/3e4938892314490c34b7cf94ad5a303c41817a908324aa236427ae5a515c5214/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73776174746563682f637275642f74657374732f6d61696e3f6c6162656c3d7465737473)](https://camo.githubusercontent.com/3e4938892314490c34b7cf94ad5a303c41817a908324aa236427ae5a515c5214/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73776174746563682f637275642f74657374732f6d61696e3f6c6162656c3d7465737473)[![Code Quality](https://camo.githubusercontent.com/ab3a49ff91cc4f6a1ccbfda0637769e25c6e62e35c07eb1481bf2275cda0c046/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73776174746563682f637275642f7175616c6974792f6d61696e3f6c6162656c3d636f64652532307175616c697479)](https://camo.githubusercontent.com/ab3a49ff91cc4f6a1ccbfda0637769e25c6e62e35c07eb1481bf2275cda0c046/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f776f726b666c6f772f7374617475732f73776174746563682f637275642f7175616c6974792f6d61696e3f6c6162656c3d636f64652532307175616c697479)

SwatTech CRUD is an enterprise-grade CRUD generator for Laravel 12 with Vuexy theme integration. It analyzes your database schema and automatically detects relationships, generating feature-rich code with a single command.

📋 Comprehensive Features
------------------------

[](#-comprehensive-features)

### Core Generation

[](#core-generation)

- 🚀 **Complete CRUD Operations** - Models, controllers, repositories, services, views, and routes
- 🔄 **Smart Relationship Detection** - Auto-detects and implements all relationship types
- 🧩 **Repository Pattern** - Clean, maintainable code structure with caching implementation
- 📱 **Responsive Views** - Mobile-friendly interfaces with Vuexy theme components
- 🧪 **Test Suite Generation** - Unit, feature, API, and browser tests with realistic data

### Advanced Features

[](#advanced-features)

- 📝 **Smart Validation** - Form request classes with context-aware rules based on schema
- 🔍 **Powerful Filtering** - Advanced search, column filtering, and custom scopes
- 📊 **Data Export** - CSV, Excel, PDF export with customizable formatting
- 🔒 **Authorization** - Policy generation with ownership checks and role integration
- 📡 **API Resources** - RESTful API endpoints with proper resources and transformers
- 📚 **Documentation** - Auto-generated API and usage documentation

### Enterprise Features

[](#enterprise-features)

- 📜 **Activity Logging** - Comprehensive audit trail system for all operations
- 📂 **Media Management** - File upload and management with preview support
- 🔄 **Soft Deletes** - Trash management with restore capabilities
- 🌐 **Internationalization** - Multi-language support with translation management
- 📊 **Batch Operations** - Process records in bulk with progress tracking
- 🔄 **Versioning** - Track changes with version history and comparison

### UI Components

[](#ui-components)

- 📋 **Data Tables** - Sortable, filterable data tables with pagination
- 📑 **Tabs &amp; Cards** - Organized content with tabbed interfaces
- 🔍 **Advanced Filters** - Date ranges, multi-select filters, saved queries
- 📤 **Export Buttons** - One-click data export to multiple formats
- 📝 **Rich Forms** - Date pickers, wysiwyg editors, select2 dropdowns
- 🔔 **Notifications** - User notification system with real-time updates

🔧 Installation
--------------

[](#-installation)

### Prerequisites

[](#prerequisites)

- PHP 8.1 or higher
- Laravel 12.x
- Composer 2.0+
- Database connection configured in your .env file

### Step 1: Install via Composer

[](#step-1-install-via-composer)

```
composer require swattech/crud
```

### Step 2: Publish Configuration

[](#step-2-publish-configuration)

```
php artisan vendor:publish --provider="SwatTech\Crud\SwatTechCrudServiceProvider" --tag="config"
```

### Step 3: Publish Assets (Optional)

[](#step-3-publish-assets-optional)

```
php artisan vendor:publish --provider="SwatTech\Crud\SwatTechCrudServiceProvider" --tag="assets"
```

### Step 4: Run Migrations (Optional)

[](#step-4-run-migrations-optional)

Only needed if you want to use activity logging, media, etc.

```
php artisan migrate
```

⚙️ Configuration
----------------

[](#️-configuration)

The package is highly customizable through the `config/crud.php` file:

```
// config/crud.php

return [
    // Path configurations for generated files
    'paths' => [
        'models' => 'app/Models',
        'controllers' => [
            'web' => 'app/Http/Controllers',
            'api' => 'app/Http/Controllers/API',
        ],
        'views' => 'resources/views',
        // Additional paths...
    ],

    // Namespace configurations
    'namespaces' => [
        'models' => 'App\\Models',
        // Additional namespaces...
    ],

    // Model settings
    'models' => [
        'soft_deletes' => true,
        'timestamps' => true,
        'with_factory' => true,
        // Additional model settings...
    ],

    // Theme settings
    'theme' => [
        'name' => 'vuexy',
        'assets' => [
            // Theme assets...
        ],
    ],

    // Additional configuration options...
];
```

🚀 Usage Examples
----------------

[](#-usage-examples)

### Generate Complete CRUD

[](#generate-complete-crud)

Generate all files for a table:

```
php artisan crud:generate products
```

This will create:

- Model with relationships
- Repository and Service classes
- Controller with CRUD actions
- Form Request validation classes
- Blade views with Vuexy theme
- Routes in web.php
- Factory and Seeder
- Policy for authorization
- Tests for all components

### Generate API Only

[](#generate-api-only)

Create API endpoints and resources:

```
php artisan crud:api products
```

### Generate with Specific Options

[](#generate-with-specific-options)

Customize the generation process:

```
php artisan crud:generate products --with-api --skip-views --force
```

### Generate for Multiple Tables

[](#generate-for-multiple-tables)

Process all tables in your database:

```
php artisan crud:generate --all
```

### Generate Only Relationships

[](#generate-only-relationships)

Add relationship methods to existing models:

```
php artisan crud:relationships products
```

### Generate Documentation

[](#generate-documentation)

Create comprehensive documentation:

```
php artisan crud:docs products
```

📚 Command Reference
-------------------

[](#-command-reference)

### crud:generate

[](#crudgenerate)

```
php artisan crud:generate {table?}
                          {--all : Generate CRUD for all tables}
                          {--connection= : Database connection to use}
                          {--path= : Custom output path}
                          {--namespace= : Custom namespace}
                          {--with-api : Generate API endpoints}
                          {--with-tests : Generate tests}
                          {--model : Generate only model}
                          {--controller : Generate only controller}
                          {--repository : Generate only repository}
                          {--service : Generate only service}
                          {--views : Generate only views}
                          {--factory : Generate only factory}
                          {--migration : Generate only migration}
                          {--seeder : Generate only seeder}
                          {--policy : Generate only policy}
                          {--resource : Generate only API resource}
                          {--request : Generate only form requests}
                          {--observer : Generate only observer}
                          {--event : Generate only events}
                          {--listener : Generate only listeners}
                          {--job : Generate only jobs}
                          {--force : Overwrite existing files}
                          {--dry-run : Run without creating any files}
                          {--theme= : Specify the theme for views (default: vuexy)}
```

### crud:api

[](#crudapi)

Generate API-specific components:

```
php artisan crud:api {table?}
                     {--all : Generate API for all tables}
                     {--connection= : Database connection to use}
                     {--controller : Generate only API controller}
                     {--resource : Generate only API resource}
                     {--documentation : Generate only API documentation}
                     {--transformer : Generate only API transformers}
                     {--version= : API version (default: v1)}
                     {--versions= : Multiple API versions separated by comma}
                     {--prefix= : API route prefix}
                     {--middleware= : API middleware to apply}
                     {--auth= : Authentication type (token, sanctum, passport, jwt)}
                     {--format= : Response format (json, jsonapi)}
                     {--collection : Generate resource collection}
                     {--swagger : Generate Swagger/OpenAPI documentation}
                     {--force : Overwrite existing files}
```

### crud:relationships

[](#crudrelationships)

Analyze and generate relationships:

```
php artisan crud:relationships {table?}
                              {--all : Generate relationships for all tables}
                              {--connection= : Database connection to use}
                              {--detect : Auto-detect relationships only}
                              {--inverse : Generate inverse relationships}
                              {--force : Overwrite existing methods}
```

### crud:docs

[](#cruddocs)

Generate comprehensive documentation:

```
php artisan crud:docs {table?}
                      {--all : Generate documentation for all tables}
                      {--api : Generate only API documentation}
                      {--schema : Generate only database schema documentation}
                      {--relationships : Generate only relationship diagrams}
                      {--crud : Generate only CRUD operations documentation}
                      {--validation : Generate only validation rules documentation}
                      {--ui : Generate only UI user guides}
                      {--format= : Documentation format (markdown, html, pdf)}
                      {--output= : Output directory for documentation files}
                      {--force : Overwrite existing documentation files}
```

### crud:tests

[](#crudtests)

Generate test suite:

```
php artisan crud:tests {table?}
                       {--all : Generate tests for all tables}
                       {--connection= : Database connection to use}
                       {--unit : Generate only unit tests}
                       {--feature : Generate only feature tests}
                       {--api : Generate only API tests}
                       {--browser : Generate only browser tests}
                       {--force : Overwrite existing test files}
```

🔌 Extending and Customizing
---------------------------

[](#-extending-and-customizing)

### Custom Generators

[](#custom-generators)

Extend the base generator classes to customize the code generation:

```
namespace App\Generators;

use SwatTech\Crud\Generators\ModelGenerator as BaseModelGenerator;

class CustomModelGenerator extends BaseModelGenerator
{
    public function getStub(string $filename = ""): string
    {
        return resource_path('stubs/custom-model.stub');
    }

    public function buildClass(string $table, array $schema, array $relationships): string
    {
        // Custom implementation
        $content = parent::buildClass($table, $schema, $relationships);

        // Add your customizations
        $content = str_replace(
            '// Custom traits',
            'use App\\Traits\\CustomTrait;',
            $content
        );

        return $content;
    }
}
```

Register your custom generator in a service provider:

```
// In AppServiceProvider or custom service provider
public function register()
{
    $this->app->bind(
        \SwatTech\Crud\Generators\ModelGenerator::class,
        \App\Generators\CustomModelGenerator::class
    );
}
```

### Custom Stubs

[](#custom-stubs)

Publish and edit the stub templates:

```
php artisan vendor:publish --provider="SwatTech\Crud\SwatTechCrudServiceProvider" --tag="stubs"
```

Edit the stubs in `resources/stubs/vendor/swattech/crud/`:

- Controllers: `controller.stub`, `api_controller.stub`
- Models: `model.stub`
- Views: `views/index.blade.stub`, `views/create.blade.stub`, etc.
- And many more...

### Custom Themes

[](#custom-themes)

The package comes with Vuexy theme integration by default, but you can create your own theme:

1. Publish the stubs: `php artisan vendor:publish --tag="stubs"`
2. Create a new theme directory: `resources/stubs/vendor/swattech/crud/mytheme/`
3. Add your theme files (layout.stub, views/*, components/*)
4. Update configuration: `'theme' => ['name' => 'mytheme']`

❓ Troubleshooting
-----------------

[](#-troubleshooting)

### Class Not Found Errors

[](#class-not-found-errors)

```
composer dump-autoload
```

### Permission Issues

[](#permission-issues)

```
chmod -R 755 app/
chmod -R 755 resources/
```

### Database Connection Issues

[](#database-connection-issues)

Make sure your `.env` file has the correct database configuration:

```
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=your_database
DB_USERNAME=your_username
DB_PASSWORD=your_password

```

### JavaScript/CSS Assets Not Found

[](#javascriptcss-assets-not-found)

```
php artisan vendor:publish --provider="SwatTech\Crud\SwatTechCrudServiceProvider" --tag="assets" --force
npm install
npm run dev
```

### Relationship Detection Issues

[](#relationship-detection-issues)

If relationships aren't detected properly:

```
php artisan crud:relationships your_table --detect --verbose
```

### Customizing Generated Code

[](#customizing-generated-code)

To make minor changes without extending classes:

1. Publish the config: `php artisan vendor:publish --tag="config"`
2. Publish the stubs: `php artisan vendor:publish --tag="stubs"`
3. Edit the appropriate stub files
4. Update the config to use custom stubs: `'stubs' => ['use_custom' => true]`

📝 License
---------

[](#-license)

The SwatTech CRUD package is open-sourced software licensed under the [MIT license](https://opensource.org/licenses/MIT).

👥 Contributing
--------------

[](#-contributing)

We welcome contributions to improve SwatTech CRUD! Please follow these steps:

1. Fork the repository
2. Create a feature branch: `git checkout -b feature-name`
3. Commit your changes: `git commit -m 'Add feature'`
4. Push to the branch: `git push origin feature-name`
5. Submit a pull request

Please make sure your code follows our coding standards and includes appropriate tests.

📦 Credits
---------

[](#-credits)

- Developed by [Swat Info System](https://swatinfosystem.com)
- Made with ❤️ for Laravel developers

###  Health Score

29

—

LowBetter than 59% of packages

Maintenance44

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

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

Unknown

Total

1

Last Release

437d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/777bb63524b907052c86fdecbec1f7887436cfd5fb1eb36e825f99beff227f1c?d=identicon)[Swatinfo](/maintainers/Swatinfo)

---

Top Contributors

[![Swatinfo](https://avatars.githubusercontent.com/u/75825816?v=4)](https://github.com/Swatinfo "Swatinfo (39 commits)")

---

Tags

laraveldatabasegeneratorscaffoldcrudadminRelationshipsvuexy

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Psalm

Code StyleLaravel Pint

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[spatie/laravel-backup

A Laravel package to backup your application

6.0k21.8M191](/packages/spatie-laravel-backup)[roots/acorn

Framework for Roots WordPress projects built with Laravel components.

9682.1M97](/packages/roots-acorn)[laravel-zero/framework

The Laravel Zero Framework.

3371.4M369](/packages/laravel-zero-framework)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[aedart/athenaeum

Athenaeum is a mono repository; a collection of various PHP packages

245.2k](/packages/aedart-athenaeum)[flarum/core

Delightfully simple forum software.

211.3M1.9k](/packages/flarum-core)

PHPackages © 2026

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