mwsimple/crud-generator
A Laravel CRUD generator that scaffolds resource functionality—models, migrations, controllers, and views—from your database or definitions, reducing boilerplate so you can build admin panels and data management screens faster.
First, the reality check. mwsimple/crud-generator is a Symfony bundle (CrudGeneratorBundle), not a Laravel package. It ships no ServiceProvider, no config/crud-generator.php, no Artisan commands, and depends on Doctrine ORM + Twig + the Symfony 2/3 kernel. If you are on Laravel, composer require mwsimple/crud-generator will install but do nothing for you. Leverage it in one of two ways:
Minimal steps for case 1:
composer require mwsimple/crud-generator
// app/AppKernel.php
new MWSimple\Bundle\CrudGeneratorBundle\MWSimpleCrudGeneratorBundle(),
Then, in order:
php app/console list and grep for crud. Do this before anything else; guessing the command name wastes more time than any other step with a 2016-era bundle.@ORM\Column metadata to infer field types, form widgets, and validation. An unmapped or annotation-free entity produces empty scaffolding.Category), not your 40-column Order table.First use case: point it at a simple entity in a legacy admin backend and let it emit the boilerplate controller + form + index/edit templates. You are buying back maybe an hour per entity — that is the entire value proposition, so measure it that way.
If you are greenfield on Laravel, skip the install and read Resources/skeleton/ in the repo instead. Then map it to:
php artisan make:model Category -mcr
php artisan make:request StoreCategoryRequest
php artisan make:controller CategoryController --resource --model=Category
Entity-first, generate-once, then hand-edit. The generator is a one-shot scaffold, not a live code generator. The sustainable workflow is:
git checkout -b scaffold/category
php app/console <crud-command> --entity=AppBundle:Category
git diff # review every generated line before committing
Treat the output as a code review artifact, not a build step. Never re-run the generator over a file you have already customized — commit first so you can git checkout -- whatever it clobbers.
Override the skeletons rather than patching generated files. Symfony's bundle resource override convention is the extension point here: place files at app/Resources/MWSimpleCrudGeneratorBundle/... (or copy the skeleton directory into your own generator) so every future generation matches house style — your base controller, your layout block names, your naming conventions. Doing this once pays for itself on the second entity.
Compose with a base admin controller. Generated controllers typically extend the framework controller directly. Change the skeleton so they extend your AdminController instead, inheriting auth checks, flash-message helpers, and pagination defaults. This is the single highest-leverage edit you can make to the templates.
Keep generated routes in one imported file. Have the generator emit a resource block, then import it centrally:
# app/config/routing.yml
admin_category:
resource: "@AppBundle/Resources/config/routing/category.yml"
prefix: /admin
Then wrap the prefix in your firewall. Generated controllers almost never include authorization — assume you must add it.
Layer validation separately. The generated FormType gives you widgets and basic required flags from Doctrine nullable/长度 metadata. Real constraints (unique slugs, min/max, Assert\Email) belong in the entity or a dedicated validator, not hand-added to a file the generator owns.
For Laravel developers porting the pattern: the structural mapping is direct — FormType → FormRequest, Twig index.html.twig → Blade index.blade.php, generated Controller actions → resource controller methods, route YAML → Route::resource(). What you should not port is the field-type inference; Laravel migrations plus $casts and a Blueprint-style schema reader give you the same information more reliably.
Integration tip: generate into a dedicated namespace (AppBundle\Admin\) rather than the default, so scaffolded code is trivially identifiable later — and trivially deletable when you replace it.
AbstractController, service definitions in XML/YAML from the Symfony 2 era. Budget for a vendored fork if you must run it on a modern runtime.php artisan vendor:publish, no config file, no facade. If your assessment assumed Laravel ergonomics, discount the whole thing and evaluate only the templates.snake_case columns) mangle labels and form field names. Relations (ManyToOne, ManyToMany) are often scaffolded as raw IDs or skipped entirely — plan to hand-write association widgets.index actions typically findAll(). On any real table this is a production incident waiting for a support ticket — add a paginator and a search form before shipping.app/console cache:clear, (3) entity actually has Doctrine mapping loaded (doctrine:mapping:info), (4) entity bundle notation correct (AppBundle:Category, not a FQCN), (5) run with -v to see which skeleton paths were resolved.app/Resources/, (2) subclass the generator command in your own bundle, (3) fork the repo. Never edit vendor/ in place.__construct or a kernel.controller listener before the first deploy.blueprints, laravel-generator, or plain make:* commands. The 2016 release date, zero dependents, and Symfony coupling make adoption a net cost.How can I help you explore Laravel packages today?