kematjaya/crud-maker-twig-bundle

Symfony MakerBundle command that generates Twig+Form CRUD (controller, views, filter type) for an existing Doctrine entity

Maintainers

Package info

github.com/kematjaya0/crud-maker-twig-bundle

Type:symfony-bundle

pkg:composer/kematjaya/crud-maker-twig-bundle

Transparency log

Statistics

Installs: 5

Dependents: 1

Suggesters: 0

Stars: 0

Open Issues: 0

v1.0.1 2026-08-26 17:29 UTC

This package is auto-updated.

Last update: 2026-08-26 17:31:01 UTC


README

Symfony MakerBundle commands that generate a server-rendered CRUD (Symfony Form + Twig + Bootstrap: controller, views, filter type) for an existing Doctrine entity.

Older, server-rendered code path — see kematjaya/crud-maker-api-bundle instead if you're building an API Platform + Next.js frontend.

1. Install

composer require kematjaya/crud-maker-twig-bundle

Register the bundle in config/bundles.php:

Kematjaya\CrudMakerBundle\Twig\CrudMakerTwigBundle::class => ['all' => true],

Requires symfony/twig-bundle, symfony/form, symfony/security-csrf and doctrine/doctrine-bundle in your project (all declared as dependencies, so a plain composer require pulls them in if missing).

2. Have an entity

The entity must already exist (make:entity or hand-written) with a repository class.

3. Generate a filter form (optional, before step 4 if you want include-filter)

php bin/console make:kmj-filter
Argument Meaning
name Filter class name (e.g. NoteFilterType)
bound-class Entity/model the filter form binds to — autocompletes, blank for none

Uses SpiriitLabs form filter bundle filter types under the hood.

4. Generate the CRUD

php bin/console make:kmj-crud
Argument Meaning
entity-class The entity to generate CRUD for — autocompletes
namespace Additional controller namespace segment — blank for default
include-filter Wire in the filter type generated in step 3? (y/n)
modal-form Render create/edit as a modal instead of a full page? (y/n)
theme View theme: bootstrap-3, bootstrap-4, or bootstrap-5 (default)

Non-interactively:

php bin/console make:kmj-crud Note "" y n bootstrap-5 --no-interaction

What gets written

  • src/Controller/{Entity}Controller.php — index/create/edit/show/delete actions with pagination (KnpPaginatorBundle)
  • templates/{entity}/index.html.twig, form.html.twig, show.html.twig, _delete_form.html.twig, _filters.html.twig, _max_per_page.html.twig — matching the chosen theme

5. If using modal-form

Add this to your base template:

<div class="modal fade" id="myModal">
    <div class="modal-content" id="modal-dialog">
        <div style="text-align: center"><img src="{{ asset('bundles/basecontroller/images/loading.gif') }}" style="width: 20px"/></div>
    </div>
</div>

...and make sure jQuery is loaded on the page.

Overriding the generator templates

# config/packages/crud_generator.yaml
# assume your custom templates live in root-project/generator
crud_maker_twig:
    templates:
        path: '%kernel.project_dir%/generator'

Custom templates are looked up first, falling back to the bundle's own skeletons — you only need to override the ones you actually want to change.

Credits