survos / ez-bundle
configure EasyAdmin with attributes
Fund package maintenance!
Requires
- php: ^8.5
- easycorp/easyadmin-bundle: ^5.9
- survos/field-bundle: ^2.45.36
- survos/kit-bundle: ^2.5
- survos/menu-bundle: ^2.5
- symfony/config: ^7.4||^8.1
- symfony/console: ^7.4||^8.1
- symfony/dependency-injection: ^7.4||^8.1
- symfony/finder: ^8.1
- symfony/form: ^8.2
- symfony/framework-bundle: ^7.4||^8.1
- symfony/http-kernel: ^7.4||^8.1
Requires (Dev)
- nette/php-generator: ^4.2
- phpstan/phpstan-symfony: ^2.0
- symfony/phpunit-bridge: ^7.4||^8.1
Suggests
None
Provides
None
Conflicts
None
Replaces
None
- dev-main
- 2.45.39
- 2.45.37
- 2.45.33
- 2.45.23
- 2.41.9
- 2.41.5
- 2.41.4
- 2.39.0
- 2.34.29
- 2.33.0
- 2.10.25
- 2.10.19
- 2.10.18
- 2.10.17
- 2.10.16
- 2.10.15
- 2.10.14
- 2.10.13
- 2.10.12
- 2.10.11
- 2.10.10
- 2.10.9
- 2.10.8
- 2.10.7
- 2.10.6
- 2.10.5
- 2.10.4
- 2.10.3
- 2.10.2
- 2.10.1
- 2.10.0
- 2.9.4
- 2.9.3
- 2.9.2
- 2.9.1
- 2.9.0
- 2.8.4
- 2.8.3
- 2.8.2
- 2.8.1
- 2.8.0
- 2.7.23
- 2.7.22
- 2.7.21
- 2.7.20
- 2.7.19
- 2.7.18
- 2.7.17
- 2.7.16
- 2.7.15
- 2.7.14
- 2.7.13
- 2.7.12
- 2.7.11
- 2.7.10
- 2.7.9
- 2.7.8
- 2.7.7
- 2.7.6
- 2.7.5
- 2.7.4
- 2.7.3
- 2.7.2
- 2.7.1
- 2.7.0
- 2.6.0
- 2.5.8
- 2.5.7
- 2.5.6
- 2.5.5
- 2.5.3
- 2.5.2
- 2.5.1
- 2.5.0
- 2.4.4
- 2.4.3
- 2.4.2
- 2.4.1
- 2.4.0
- 2.3.0
- 2.2.5
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.2
- 2.1.1
- 2.0.220
- 2.0.219
- 2.0.218
- 2.0.217
- 2.0.216
- 2.0.215
- 2.0.214
- 2.0.213
- 2.0.212
- 2.0.211
- 2.0.210
- 2.0.209
- 2.0.208
- 2.0.207
- 2.0.206
- 2.0.205
- 2.0.204
- 2.0.203
- 2.0.202
- 2.0.201
- 2.0.200
- 2.0.199
- 2.0.198
- 2.0.197
- 2.0.196
- 2.0.195
- 2.0.194
- 2.0.193
- 2.0.192
- 2.0.191
- 2.0.190
- 2.0.189
- 2.0.188
- 2.0.187
- 2.0.186
- 2.0.185
- 2.0.184
- 2.0.183
- 2.0.182
- 2.0.181
- 2.0.180
- 2.0.179
- 2.0.178
- 2.0.177
- 2.0.176
- 2.0.175
- 2.0.174
- 2.0.173
- 2.0.172
- 2.0.171
- 2.0.170
- 2.0.169
- 2.0.168
- 2.0.167
- 2.0.166
- 2.0.165
- 2.0.164
- 2.0.163
- 2.0.162
- 2.0.161
- 2.0.160
- 2.0.159
- 2.0.158
- 2.0.156
- 2.0.155
- 2.0.154
- 2.0.146
- 2.0.145
- 2.0.144
- 2.0.143
- 2.0.142
- 2.0.141
- 2.0.140
- 2.0.139
- 2.0.138
- 2.0.137
- 2.0.136
- 2.0.135
- 2.0.134
- 2.0.133
- 2.0.132
- 2.0.131
- 2.0.130
- 2.0.129
- 2.0.128
- 2.0.127
- 2.0.126
- 2.0.125
- 2.0.124
- 2.0.123
- 2.0.122
- 2.0.121
- 2.0.120
- 2.0.119
- 2.0.117
- 2.0.116
- 2.0.115
- 2.0.114
- 2.0.113
- 2.0.112
- 2.0.111
- 2.0.110
- 2.0.109
- 2.0.108
- 2.0.107
- 2.0.106
- 2.0.105
- 2.0.104
- 2.0.103
- 2.0.102
- 2.0.101
- 2.0.100
- 2.0.99
- 2.0.98
- 2.0.97
- 2.0.96
- 2.0.95
- 2.0.94
- 2.0.93
- 2.0.92
- 2.0.91
- 2.0.90
- 2.0.89
- 2.0.88
- 2.0.87
- 2.0.86
- 2.0.85
- 2.0.84
- 2.0.83
- 2.0.82
- 2.0.81
- 2.0.80
- 2.0.79
- 2.0.78
- 2.0.77
- 2.0.76
- 2.0.75
- 2.0.74
- 2.0.73
- 2.0.72
- 2.0.71
- 2.0.70
- 2.0.69
- 2.0.68
- 2.0.67
- 2.0.66
- 2.0.65
- 2.0.64
- 2.0.63
- 2.0.62
- 2.0.61
- 2.0.60
- 2.0.59
- 2.0.58
- 2.0.57
- 2.0.56
- 2.0.55
- 2.0.54
- 2.0.53
- 2.0.51
- 2.0.50
- 2.0.49
- 2.0.48
- 2.0.47
- 2.0.46
- 2.0.45
- 2.0.44
- 2.0.43
- 2.0.42
- 2.0.41
- 2.0.40
- 2.0.39
- 2.0.38
- 2.0.37
- 2.0.36
- 2.0.35
- 2.0.34
- 2.0.33
- 2.0.32
- 2.0.31
- 2.0.30
- 2.0.29
- 2.0.28
- 2.0.27
- 2.0.26
- 2.0.25
- 2.0.24
- 2.0.23
- 2.0.22
- 2.0.21
- 2.0.20
- 2.0.19
- 2.0.18
- 2.0.17
- 2.0.16
- 2.0.15
- 2.0.14
- 2.0.13
- 2.0.12
- 2.0.11
- 2.0.10
- 2.0.9
- 2.0.8
- 2.0.7
This package is auto-updated.
Last update: 2026-11-11 12:43:19 UTC
README
Lightweight tools that extend EasyAdmin (easycorp/easyadmin-bundle).
Features
- Event-driven menu slots across desktop/mobile headers, page navigation, actions, sidebar and footer
- Define default fields via attributes
- Generate all entity crud controllers via a single command (code-bundle?)
- Automatic configuration of filters
- Base controller defaults to read-only for non-admins
Installation
Install the bundle using Composer:
composer require survos/ez-bundle
Menu integration
Requires PHP 8.5, Symfony 8.2+, EasyAdmin 5.9+, Twig 3.29+ and survos/menu-bundle. The bundle registers its slot layout by default. See menu integration for listeners, page context, locale placement and replacing the listing action. KnpMenuBundle still provides the library factory and matcher; it is not removed by this integration.
FieldReader and native forms
Requires survos/field-bundle and Symfony Form 8.2. Both EZ base CRUD controllers
now use FieldReader when descriptors or native FormField attributes are present:
use Survos\FieldBundle\Attribute\Field; use Symfony\Component\Form\Attribute\FormField; use Symfony\Component\Validator\Constraints as Assert; #[Field(order: 10, sortable: true, filterable: true)] #[FormField] #[Assert\PositiveOrZero] public int $stock = 0;
- Index/detail pages use visible descriptors in their declared order. Unlisted Doctrine fields are not appended, including JSONB caches and backing properties.
- New/edit pages include only properties with FormField. Symfony's form factory
guesses types, required/empty values and options; explicit types/options are honored.
Form names can differ using
name, mapped back withproperty_path. Field(visible: false)controls display; only adding FormField opts a property into editing. A display-only model therefore has no automatically editable fields.- Sorting and filters require actual Doctrine-mapped properties. Virtual hooks can render and edit, but are not automatically translated into SQL backing-column names.
- Keep thin controllers: override
preferredFields()on AbstractEzCrudController for fields that should win, or overrideconfigureFields()and retain parent fields. - Models without either metadata source retain the legacy EzField/EA behavior.
This bridges property-level native form attributes into EasyAdmin's existing CRUD form. It does not register entity classes as AsFormType services or replace EA's submission, validation, CSRF, persistence or permissions. Standalone readonly DTO forms continue to use Symfony's AsFormType directly. Attribute options are PHP values; container service references in options are not resolved by this runtime bridge.
The internal DummyJSON app (~/sites/dummy) exercises this with Product, Babel
property hooks, an Imagor thumbnail override and authenticated edit/validation tests.
Legacy usage
use Survos\EzBundle\Attribute\EzAdmin; use Survos\EzBundle\Attribute\EzField; use Survos\EzBundle\Attribute\Page; #[EzAdmin(icon: 'fa-regular fa-image', defaultSort: ['year' => 'DESC'], indexMax: 12)] class ForteObj { #[EzField(index: true, order: 1, filter: true)] public ?int $year = null; #[EzField(index: true, order: 2)] public ?string $title = null; }
Testing
Run the test suite:
./vendor/bin/phpunit
License
This bundle is released under the MIT license. See the LICENSE file for details.
Field label translations
FieldReader-backed columns use the property name as a translation key in the
Symfony fields domain. Supply translations/fields.en.yaml,
fields.es.yaml, or equivalent XLIFF catalogues. For example:
# translations/fields.es.yaml price: Precio stock: Existencias
#[Field(transKey: 'product.price')] overrides the key. Labels resolve in the
rendering locale, including Symfony locale fallbacks; missing keys use the
descriptor's readable fallback. EasyAdmin inherits these labels for filters.
Native #[FormField] fields use the same key/domain by default (aliases retain
the original property's key). Explicit form label, label_format, and
translation_domain options take precedence, including label: false and
translation_domain: false. Thin-controller field overrides remain authoritative.
These catalogues translate UI labels, independently of Babel-translated entity
values. Lingua users can harvest the English catalogue with
lingua:harvest:messages --domains=fields; dynamically derived field keys must
be present in that catalogue because Twig extraction cannot discover them.
The header also renders ADMIN_NAVBAR_MENU and ADMIN_NAVBAR_MENU_END using
the same listeners as Tabler. Like Tabler, these slots are visible to
ROLE_ADMIN users or in debug mode, and honor tabler_admin_toolbar: false.