Weave Code
Code Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Laravel Auto Crud Laravel Package

mrmarchone/laravel-auto-crud

Generate full CRUD scaffolding for Laravel models via an interactive Artisan command. Auto-creates controllers, validation requests, routes, views, and optional API artifacts (cURL, Swagger), with overwrite/all options and support for repository pattern and Spatie Data.

View on GitHub
Deep Wiki
Context7

Getting Started

Start by installing the package as a dev dependency: composer require mrmarchone/laravel-auto-crud --dev. Then publish the config with php artisan vendor:publish --provider="Mrmarchone\LaravelAutoCrud\LaravelAutoCrudServiceProvider" --tag="auto-crud-config". Run php artisan auto-crud:generate --help to see available options. The most common first use case is generating CRUD for a single model interactively: php artisan auto-crud:generate (select model(s) from list), or non-interactively for a known model: php artisan auto-crud:generate --model=User --type=web. This instantly creates controller, request, views, and routes — ideal for bootstrapping admin panels or internal tools.

Implementation Patterns

  • Rapid Prototyping: Generate full CRUD scaffolding for new models during early development, then customize just what’s needed (e.g., adjust rules in generated UserRequest).
  • API-First Development: Use --type=api --repository --pattern=spatie-data to generate API controllers with service layers, validated data objects, and resource collections. Add --swagger-api or --postman for OpenAPI/Postman docs.
  • Consistent Architecture: Enforce layering across a team by consistently using flags like --repository (for service/IRouting pattern) or --pattern=spatie-data (for typed data objects), avoiding ad-hoc controller logic.
  • Bulk Generation: Use --all or multiple --model= flags (e.g., --model=User --model=Post) to scaffold CRUD for several models in one command — useful for database-first workflows or legacy integrations.
  • CI Integration: Use --no-interaction + --overwrite in CI pipelines or migration scripts to scaffold CRUD from YAML/JSON model definitions (e.g., via external tools).

Gotchas and Tips

  • Path Escalation Risk: If your models live outside app/Models, set --model-path carefully — e.g., --model-path=app/Modules/Posts may create app/Http/Controllers/Modules/Posts/Controller.php. Double-check config/auto-crud.php for directories config to avoid unexpected folder nesting.
  • Overwrite Caution: Always use --overwrite with care in collaborative environments; consider generating to a temporary directory first via a wrapper script to inspect changes.
  • Validation Scaffolding: The generated *Request files use simple rules() based onfillable; override in rules() manually or extend validation via custom request templates (extendable via config: request_namespace, request_base_class).
  • Missing View Customization: Views are basic Blade stubs — customize via view_namespace config or republish views and use extends/@section to reuse layouts. No automatic Blade component integration by default.
  • Repository & Spatie Data Dependency: --repository and --pattern=spatie-data require their respective packages (mrmarchone/laravel-service, spatie/laravel-data) to be installed, but no automatic install happens — fail at runtime if missing. Document as prerequisites.
  • Route Registration: Routes are output to console only — copy/paste or redirect to a file: php artisan auto-crud:generate ... --type=web > routes/auto-crud.php. Consider adding auto-loading via a RouteServiceProvider hook if used heavily.
  • Debugging: Use -vvv for verbose output to see which models were found, which files skipped (if --overwrite not used), and template resolution paths — helps when patterns fail silently.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
davejamesmiller/laravel-breadcrumbs
artisanry/parsedown
christhompsontldr/phpsdk
enqueue/dsn
bunny/bunny
enqueue/test
enqueue/null
enqueue/amqp-tools
milesj/emojibase
bower-asset/punycode
bower-asset/inputmask
bower-asset/jquery
bower-asset/yii2-pjax
laravel/nova
spatie/laravel-mailcoach
spatie/laravel-superseeder
laravel/liferaft
nst/json-test-suite
danielmiessler/sec-lists
jackalope/jackalope-transport