stalkdeveloper/laravel-crud-generator

Laravel CRUD generator package for API and Web with customizable Artisan command and built-in support for models, controllers, validation, API resources, Yajra datatables, and Blade views.

v1.0.0 2025-07-05 19:17 UTC

This package is auto-updated.

Last update: 2025-07-05 20:51:34 UTC


README

Packagist Version License Stars

A powerful CRUD generator for Laravel that supports API, Web, and Repository pattern.

✨ Features

  • Generate CRUD for Web/API/Both
  • Repository Pattern support
  • Customizable stubs
  • Auto route registration
  • PSR-4 structure
  • Laravel 9+ compatible

🚀 Installation

  1. Install via Composer

    composer require stalkdeveloper/laravel-crud-generator
    
  2. Publish Configuration and Stubs

    php artisan vendor:publish --tag=crud-generator-config
    
  3. (Optional) Customize Configuration

    Edit config/crud-generator.php to customize namespaces, paths, and stub locations as per your project structure.

💻 Usage To generate a basic Web CRUD:

Web CRUD

php artisan make:crud Post --web

API CRUD

php artisan make:crud Post --api

Both Web & API

php artisan make:crud Post --all

With Repository

php artisan make:crud Post --repo

Force overwrite

php artisan make:crud Post --force

🏗 Repository Setup Add to AppServiceProvider.php:

public function register() { $this->app->bind( \App\Interfaces\PostInterface::class, \App\Repositories\PostRepository::class ); }

📂 Generated Structure (click to expand)

app/ ├── Models/ │ └── Post.php ├── Http/ │ ├── Controllers/ │ │ ├── PostController.php │ │ ├── Web/ │ │ │ └── PostController.php │ │ └── Api/ │ │ ├── PostController.php │ │ └── ApiBaseController.php │ ├── Requests/ │ │ ├── PostRequest.php │ │ ├── Web/ │ │ │ └── PostRequest.php │ │ └── Api/ │ │ └── PostRequest.php │ └── Resources/ │ ├── PostResource.php │ └── PostCollection.php ├── Interfaces/ │ └── PostInterface.php ├── Repositories/ │ └── PostRepository.php resources/ └── views/ └── posts/ ├── index.blade.php ├── create.blade.php ├── edit.blade.php └── show.blade.php database/ └── migrations/ └── 202x_xx_xx_xxxxxx_create_posts_table.php

📜 License

This project is licensed under the MIT License - see the LICENSE file for details.

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check issues page or submit a pull request.

Please read CONTRIBUTING.md for details.

📬 Support

If you have any questions or need help, feel free to open an issue or contact me on LinkedIn.

Happy Coding! 🚀
Built with ❤️ by Sunny Kumar

🌐 Portfolio