Weave 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

Crud Generator Laravel Package

hitocean/crud-generator

A Laravel package that scaffolds CRUD functionality for your models, generating controllers, models, routes, views, and migrations from your database schema so you can skip repetitive boilerplate and start building features faster.

View on GitHub
Deep Wiki
Context7

Getting Started

Reality check first. This package is archived, has zero stars, zero dependents, and a single release (2024-06-24). Treat it as a reference implementation you fork, not a dependency you composer require in a production app. The practical first step is to clone the repo locally and read it before installing.

Minimal install (for evaluation):

# Prefer a VCS path so you can patch it
composer config repositories.crud-generator vcs https://github.com/vadiun-dev/crud-generator
composer require hitocean/crud-generator:@dev --dev

Register the service provider if it isn't auto-discovered (Laravel 11+ needs it in bootstrap/providers.php):

Hitocean\CrudGenerator\CrudGeneratorServiceProvider::class,

Where to look first, in order:

  1. README.md — the only reliable source for the actual command signature, since there are no docs site and no dependents to copy from.
  2. src/Commands/ (or src/Console/) — the artisan signature and the questions the generator asks.
  3. stubs/ — this is the real contract. Whatever the stubs emit is what you'll live with; read them before you run anything.
  4. config/crud-generator.php (if present) — namespaces, paths, and stub overrides.

First use case: generate a trivial resource end-to-end before trusting it with anything real. Pick a Post model with title:string, body:text, published_at:timestamp. Run the generator against a clean branch, then git diff the result. You want to see: migration, model, controller, form request(s), routes, and views (or API resource). If any of those are missing or land in unexpected paths, adjust config/stubs before generating a second time.

php artisan vendor:publish --tag=crud-generator   # publish config + stubs if supported
php artisan list | grep -i crud                   # confirm the real command name

Implementation Patterns

1. Stub-first workflow (the only sane way to use this). Do not run the generator against your app and hope. Publish the stubs into stubs/vendor/crud-generator/, edit them to match your house style (base controller, ApiResponse trait, form-request conventions, casts), then generate. Every subsequent generation is then consistent.

2. Generate into a branch, review, commit. A CRUD generator is a code-writing tool; treat its output like a PR from a junior dev.

git checkout -b feat/posts-crud
php artisan crud:generate Post ...   # exact args from README
git diff --stat
git diff                              # read every file

3. Field-specification pattern. Most generators of this shape accept fields either as CLI args (name:string, price:decimal) or via an interactive prompt. Whichever this one uses, keep a docs/crud-specs/*.md file per resource recording the exact invocation. Regeneration and audits become reproducible, and you don't have to reverse-engineer the command from the migration six months later.

4. Layer the generator, don't replace your conventions. Typical integration:

Concern Generated? Your responsibility
Migration yes Indexes, FKs, soft deletes, column order
Model yes Relationships, casts, scopes, $fillable review
Controller yes Authorization ($this->authorize), pagination, filters
Form Requests maybe Custom rules, prepareForValidation
Routes yes Middleware groups, route model binding, prefixes
Policies usually no Write by hand — don't skip this
Tests almost never Write by hand — highest-value gap

The generated code gets you to ~60%. The remaining 40% (authz, validation nuance, tests, relationships) is where bugs live.

5. Pair with your existing auth layer. Generated controllers rarely include policy checks. Add a Gate::before or a base controller that enforces authorization, so generated controllers inherit it rather than requiring per-method edits.

6. API vs. web mode. If the package supports a --api flag (check the signature), prefer it for JSON resources — it avoids Blade stubs you'll delete. If it doesn't, strip the view stubs from the published stub set and regenerate.

7. Idempotency discipline. Run generation once per resource, in a clean tree. If you need to regenerate, git stash or delete the previously generated files first — most generators of this vintage overwrite blindly and will clobber your hand-edits.

Gotchas and Tips

The archive is the headline gotcha. No security patches, no Laravel 11/12 compatibility guarantees, no issue triage. Before adopting:

  • Check composer.json for the illuminate/* constraint. If it caps at ^10.0, it will not install cleanly on a modern app.
  • Check the PHP version floor.
  • Vendor the package (repositories VCS + a fork under your org) so you control fixes.

Overwrite behavior is unspecified — assume the worst. Back up or commit before every run. If the generator writes to app/Models/User.php-style shared files, verify it doesn't damage existing models.

Namespace and path assumptions. These packages hardcode App\Models, App\Http\Controllers, database/migrations. If your app uses App\Domain\... or modular structure, the config (if publishable) is the lever. If config isn't publishable, the stub files are — edit paths inside them.

Migration timestamp collisions. Generating several resources in one minute produces identical timestamps and ambiguous ordering. Rename or generate one at a time when FKs are involved.

Debugging generation failures:

php artisan crud:generate Post -vvv    # see the exception + stack

If it fails silently, check storage/logs/laravel.log and confirm the stubs directory is actually being resolved (config('crud-generator.stub_path') or equivalent). A missing stub usually surfaces as an empty/corrupt file, not an error.

Extension points to lean on:

  • Published stubs — the primary customization surface; version them in your repo.
  • Config file — namespaces, paths, stub overrides.
  • Service provider bindings — if the package resolves a generator class from the container, you can swap it with a subclass in AppServiceProvider without forking.
  • Artisan events — unlikely here, but check for CommandFinished hooks if you want post-generation formatting (vendor/bin/pint).

Always run Pint and PHPStan after generating:

vendor/bin/pint --dirty
vendor/bin/phpstan analyse app/Http/Controllers app/Models

Generated code frequently has unused imports, missing return types, and inconsistent quoting. This catches it in seconds.

Write tests for generated endpoints immediately. The generator won't. A single Pest/PHPUnit feature test per resource (index, store validation failure, show, update, destroy) is the cheapest insurance against the "it generated, therefore it works" trap — which, with an archived zero-star package, is a trap worth taking seriously.

When to skip this package entirely. For a one-off CRUD screen, php artisan make:model -mcsr plus 20 minutes of typing is faster than auditing an unmaintained generator. This package earns its keep only if you're scaffolding many similar resources and you've invested in stubs that match your codebase. Otherwise, the maintenance cost outweighs the typing saved.

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.
mehedimi/laravel-amp-mail
happones/laravel-vue-i18n-generator
jwerd/inertia-table
siberfx/flysystem-wasabi
hollyit/token-replace
ippanelcom/laravel-sdk
adachsoft/changelog-linter
adachsoft/collection
payerurl/telegrambot-crypto-payment-instant-payout
dskripchenko/laravel-hybrid-search
riorizkyrainey/lara-ced
mehedimi/static-vel
zharp/zharp
nonsapiens/bigquery-model-sync
lgu-bayambang-ict-office/lgu-laravel-development-standards
andydefer/laravel-support
se7enxweb/flysystem
lampwick/laravel
jeslage/statamic-emojis
micahdshackelford/rmap-laravel