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

triton/crud-generator

Laravel CRUD generator that scaffolds models, controllers, form requests, routes, and views from your database tables. Quickly build admin panels and APIs with customizable templates and validation, generating clean code you can edit and extend.

View on GitHub
Deep Wiki
Context7

Getting Started

Framing note: despite the "Laravel developer" prompt, this is a Symfony 3 / Doctrine bundle (PetkoparaCrudGeneratorBundle), not a Laravel package. You can't composer require it into a Laravel app and get working CRUD. Use it in a Symfony 3 project, or read it as a reference implementation for scaffolding patterns.

Minimal setup in a Symfony 3 app:

  1. composer require triton/crud-generator --dev
  2. Register the bundle in app/AppKernel.php under the dev bundles: new Petkopara\CrudGeneratorBundle\PetkoparaCrudGeneratorBundle()
  3. Have a Doctrine entity with valid mapping (and associations mapped if you want them scaffolded).
  4. Run the generator: php bin/console generate:doctrine:crud --entity=AppBundle:Product
  5. Review the generated controller (src/AppBundle/Controller/), templates (app/Resources/views/), form type, and the route added to routing.yml.

Where to look first: the generated indexAction (it defines the pagination/filter/sort query-param contract), then index.html.twig (Bootstrap 3 table, filter form, bulk-delete checkboxes). First use case: stand up an admin list/detail/new/edit screen over an existing entity in minutes, with server-side pagination, filtering, sorting, page-size selection, and bulk delete.

Implementation Patterns

  • Generate then own. Run the generator once, commit the output, then hand-edit. Treat regeneration as a one-off bootstrap, not a repeatable build step.
  • Dedicated admin area. Generate into an Admin controller namespace and route prefix (/admin/product) so security and layout can be applied uniformly.
  • Entity-first workflow. Model associations in Doctrine first; the generator reads mapping metadata to build association form fields and display columns.
  • Query-param contract. The generated index uses request params for page, page size, sort field/direction, and filter values. Preserve those names when refactoring, or update the Twig forms/links in lockstep.
  • Bulk delete. Generated as a POST form with selected IDs and a confirmation step; keep CSRF enabled and add role checks in the controller.
  • Template overrides. Copy generated Twig files into app/Resources/views/... to customize markup without touching vendor code.
  • Security integration. Wrap generated routes in access_control or add @Security annotations; the generator does not add auth.
  • Laravel translation. If you're porting the pattern to Laravel: mirror it with an Artisan command/Blueprint scaffold, Blade partials for filter/pagination, and a FormRequest for filter/sort params. The value is the query-builder pattern, not the code.

Gotchas and Tips

  • Symfony 3 only. Depends on SensioGeneratorBundle, which was removed in Symfony 4. Expect friction on PHP 7.2+ / Symfony 4/5; PHP 8 will likely need patches.
  • Dev-only bundle. Register it in the dev kernel; it is a code generator, not runtime infrastructure.
  • Overwrite is destructive. --overwrite clobbers hand edits. Always generate on a clean git branch.
  • Bootstrap 3 markup. Generated templates assume BS3 classes (col-md-*, pull-right, btn-default). Budget restyling time for BS4/5 or Tailwind.
  • Association pitfalls. Bidirectional/circular associations can produce huge select boxes or recursion in forms; switch generated EntityType fields to autocomplete where needed.
  • Unbounded page size / filters. Check bundle config and generated code for max page size; validate filter inputs, since raw query params can otherwise hit the DB hard.
  • No maintenance since 2017. Audit generated controllers/templates for CSRF, mass assignment, and XSS before shipping; don't assume modern defaults.
  • Debugging. Use bin/console debug:router to confirm generated routes, debug:twig for template resolution, and the dev log for query/param issues.
  • Extension points. Customize by overriding generator templates (copy the bundle's Resources/skeleton into your app), extending the generated controller, or forking the bundle command for your own conventions.
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.
abbasudo/artisan-route
mirvan/ippanel
ignibyte/aic-framework
glavweb/data-schema-bundle
glavweb/datagrid-bundle
tacticmedia/scim-server
uni-method/frame
neika-ai/sdk
adachsoft/php-code-style
pharaonic/laravel-notification-dependencies
beautinow/translug
dev-brainiac/bot-cloaked
octoberrain/html
octoberrain/extension
octoberrain/exception
octoberrain/contracts
adachsoft/api-version-bundle
cgv/localized-resource
noith/settings
kda/laravel-package