PHPackages                             sherlockode/crud-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Admin Panels](/categories/admin)
4. /
5. sherlockode/crud-bundle

ActiveLibrary[Admin Panels](/categories/admin)

sherlockode/crud-bundle
=======================

Bundle to generate CRUD

v0.1.1(2y ago)1291MITPHPPHP ^7.4 || ^8.0

Since May 30Pushed 3w ago5 watchersCompare

[ Source](https://github.com/sherlockode/CrudBundle)[ Packagist](https://packagist.org/packages/sherlockode/crud-bundle)[ RSS](/packages/sherlockode-crud-bundle/feed)WikiDiscussions main Synced 2w ago

READMEChangelog (3)Dependencies (5)Versions (6)Used By (0)

SherlockodeCrud Bundle
======================

[](#sherlockodecrud-bundle)

---

[ ![](https://camo.githubusercontent.com/eaa955113ccbd3a7eea00a5cab2e2757ca9c905ed1ec9e298b8a9997b2e06522/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f736865726c6f636b6f64652f637275642d62756e646c65)](https://packagist.org/packages/sherlockode/crud-bundle "License")[ ![](https://camo.githubusercontent.com/86408b5f3c2b909c200dc6e95961289d20e65fd61ff530e388e3cbeb383097ae/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736865726c6f636b6f64652f637275642d62756e646c65)](https://packagist.org/packages/sherlockode/crud-bundle "Version")[ ![](https://camo.githubusercontent.com/1aceb1842d29151338e6395522cf4713a2b0e30a5cbc000b0baa673aef2509c7/68747470733a2f2f706f7365722e707567782e6f72672f736865726c6f636b6f64652f637275642d62756e646c652f646f776e6c6f616473)](https://packagist.org/packages/sherlockode/crud-bundle "Total Downloads")

---

Overview
--------

[](#overview)

---

This bundle generate basic crud.

---

Installation
------------

[](#installation)

---

Install the bundle with composer:

```
$ composer require sherlockode/crud-bundle
```

Generate a basic grid view:

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            config:
                class: App\Entity\User
                form: App\Form\Type\UserType
            grid:
                fields:
                    name:
                        label: crud.user.name #translation key
                    surname:
                        label: crud.user.surname
                    is_active:
                        label: crud.user.active
                        type: boolean # you can define a specific type if you need. See the section bellow
                    created_at:
                        label: crud.user.created_at
                        type: date
                        options:
                            format: d-m-Y # you can customise the date format
                actions:
                    update: ~
                    delete: ~
                settings:
                    page_size: 20 #the number of elements by page, 20 by default
```

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
    type: sherlockode_crud.resource
    prefix: /admin
```

---

Customisation
-------------

[](#customisation)

#### You need custom action or custom field? You can easily define your own

[](#you-need-custom-action-or-custom-field-you-can-easily-define-your-own)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    templates:
        action:
            up_and_down: '@SherlockodeCrud/common/grid/action/up_and_down.html.twig'
        field:
            custom_field: '@SherlockodeCrud/common/grid/field/custom_field.html.twig'

    # now, you can use them like this :
    crud:
        user:
            # ...
            grid:
                fields:
                    surname:
                        label: crud.user.email
                        type: custom_field
                actions:
                    up_and_down: ~
```

#### You need the object instead of a property value in the grid?

[](#you-need-the-object-instead-of-a-property-value-in-the-grid)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                fields:
                    surname:
                        label: crud.user.email
                        path: . #use '.' to send the object instead of the property value
```

#### You need to add filters on your grid?

[](#you-need-to-add-filters-on-your-grid)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                filters:
                    name:
                        type: string
                        label: Label or custom translation key
```

#### You need to create a custom query for the grid?

[](#you-need-to-create-a-custom-query-for-the-grid)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                repository:
                    method: yourQueryBuilder
```

- In this example, in the UserRepository, you need to have a function named `yourQueryBuilder`
- The `yourQueryBuilder` function need to return a `QueryBuilder` object

#### You need filters?

[](#you-need-filters)

The bundle has basic filters

- String
- Boolean
- Float
- Money
- Date
- DateRange
- Entity

Entity filter need more configuration:

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                filters:
                    category:
                        type: entity
                        options:
                            class: App\Entity\Category
                            choice_label: name
```

To add some filters:

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                filters:
                    name:
                        type: string #the filter name
                    createdAt:
                        type: date_range
```

#### You need custom filter?

[](#you-need-custom-filter)

If you need a filter that does not exist, create it !

Create your own filter class and your own filter type class, in this example `MyCustomFilter`. `MyCustomFilter` need to implements `FilterInterface`

Now you need to set the template for your new filter:

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    templates:
        filter:
            my_custom_filter: 'Grid\Filter\my_custom_filter.html.twig'
    crud:
        user:
            # ...
            grid:
                filters:
                    name:
                        type: my_custom_filter
```

#### You need to sort your grid?

[](#you-need-to-sort-your-grid)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            # ...
            grid:
                sorting:
                    name: asc
                    surname: desc
```

#### You need to let the user choose the order?

[](#you-need-to-let-the-user-choose-the-order)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            grid:
                fields:
                    name:
                        label: crud.user.email
                        sortable: ~ #set the column sortable
```

#### You need to change the redirection a resource creation or edition?

[](#you-need-to-change-the-redirection-a-resource-creation-or-edition)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        redirect_after_create: index
        redirect_after_update: update
        base_name: sherlockode_crud
        resource_name: user
    type: sherlockode_crud.resource
    prefix: /admin
```

By default, after a resource creation or edition, you will be redirected to the update action

#### You need a custom template for a route?

[](#you-need-a-custom-template-for-a-route)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        templates: "User"
    type: sherlockode_crud.resource
    prefix: /admin
```

- In your templates project folder, be sure you have the `User` directory.
- If you need a custom template only for the index action, name it `index.html.twig`, other routes will be rendered with the defaults templates

#### You only want to create the index route, not all of them?

[](#you-only-want-to-create-the-index-route-not-all-of-them)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        only: [index]
    type: sherlockode_crud.resource
    prefix: /admin
```

#### You want to create all routes excepted delete?

[](#you-want-to-create-all-routes-excepted-delete)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        except: [delete]
    type: sherlockode_crud.resource
    prefix: /admin
```

#### You need to check permission before action?

[](#you-need-to-check-permission-before-action)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        permission: true
    type: sherlockode_crud.resource
    prefix: /admin
```

Now make your own voter for each action

- index
- create
- edit
- delete

The attribute is prefixed by the `resource_name`. In this example, it's `user_index`

#### You want to send some variable?

[](#you-want-to-send-some-variable)

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        vars:
            global:
                icon: bi bi-person-fill
```

In this example, we send an icon to all paths.

If you want to do this only for a specific path:

```
# sherlockode_crud_routing.yaml

app_admin_user:
    resource: |
        base_name: sherlockode_crud
        resource_name: user
        vars:
            index:
                icon: bi bi-person-fill
```

#### You need to remove the delete confirmation page?

[](#you-need-to-remove-the-delete-confirmation-page)

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            config:
                delete_confirmation: false
```

You need to add some information in the show view?

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            show:
                name:
                    type: string
                is_active:
                    type: boolean
                category.name:
                    type: string
                created_at:
                    type: date
                    options:
                        format: d-m-Y
```

You need to change the translation domain?

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    translation_domain: yourDomain
```

You need to disable the translation domain?

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    translation_domain: false
    crud:
        user:
            # ...
            grid:
                fields:
                    name:
                        label: My Name #you can use a translation key or the label value if translation domain is false
```

If you need to be more specific, you can disable translation or set a custom for some grids

```
# config/packages/sherlockode_crud.yaml

sherlockode_crud:
    crud:
        user:
            config:
                translation_domain: false #or yourDomain
```

If you set a translation\_domain for a grid, the value will replace the global one

#### You need to send data to the views?

[](#you-need-to-send-data-to-the-views)

In ResourceControllerDataEvent, you have several actions :

- ResourceControllerDataEvent::SHOW
- ResourceControllerDataEvent::CREATE
- ResourceControllerDataEvent::UPDATE
- ResourceControllerDataEvent::DELETE\_CONFIRMATION

In ResourceController, in show, create, update and delete confirmation actions, an even is dispatched before the page is rendered.

If you need to send data to the view, you can create a listener.

```
# src/EventListener/ResourceListener.php

class ResourceListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ResourceControllerDataEvent::UPDATE => 'update',
        ];
    }

    public function update(ResourceControllerDataEvent $event): void
    {
        // send custom data to the view
        $event->setData([]);
    }
}
```

In the view, the data variable will contain your data sent in the example above.

#### You need to prevent flush?

[](#you-need-to-prevent-flush)

In ResourceControllerEvent, you have several actions :

- ResourceControllerEvent::BEFORE\_CREATE
- ResourceControllerEvent::BEFORE\_UPDATE
- ResourceControllerEvent::BEFORE\_DELETE

In ResourceController, in create, update and delete actions, an even is dispatched before flush is performed.

If you need to cancel the flush, you can create a listener

```
# src/EventListener/ResourceListener.php

class ResourceListener implements EventSubscriberInterface
{
    public static function getSubscribedEvents(): array
    {
        return [
            ResourceControllerEvent::BEFORE_UPDATE => 'update',
        ];
    }

    public function update(ResourceControllerDataEvent $event): void
    {
        $event->setCancelProcess(true);

        // optional message, by default, a translation key is generated
        // sherlockode_crud.crud_name.update.cancel
        $event->setMessage('your message');
    }
}
```

###  Health Score

33

—

LowBetter than 72% of packages

Maintenance62

Regular maintenance activity

Popularity10

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 51.5% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~144 days

Total

3

Last Release

831d ago

PHP version history (2 changes)v0.0.1PHP ^7.3 || ^8.0

v0.1.0PHP ^7.4 || ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/fafd942dc78112d2a4b4088c8a07d01557590ee22e5881587afe6b16ad92c6d1?d=identicon)[sherlockode](/maintainers/sherlockode)

---

Top Contributors

[![BrownSim](https://avatars.githubusercontent.com/u/12810073?v=4)](https://github.com/BrownSim "BrownSim (35 commits)")[![juchi](https://avatars.githubusercontent.com/u/3333098?v=4)](https://github.com/juchi "juchi (18 commits)")[![Vowow](https://avatars.githubusercontent.com/u/3932842?v=4)](https://github.com/Vowow "Vowow (15 commits)")

---

Tags

crud

### Embed Badge

![Health badge](/badges/sherlockode-crud-bundle/health.svg)

```
[![Health](https://phpackages.com/badges/sherlockode-crud-bundle/health.svg)](https://phpackages.com/packages/sherlockode-crud-bundle)
```

###  Alternatives

[easycorp/easyadmin-bundle

Admin generator for Symfony applications

4.3k17.5M373](/packages/easycorp-easyadmin-bundle)[2lenet/crudit-bundle

The easy like Crud'it Bundle.

1715.6k12](/packages/2lenet-crudit-bundle)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.8M712](/packages/sylius-sylius)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M462](/packages/pimcore-pimcore)[sulu/sulu

Core framework that implements the functionality of the Sulu content management system

1.3k1.4M196](/packages/sulu-sulu)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
