xorgxx / neox-crud-bundle
Neox CRUD Bundle: generic factory-based CRUD with handlers, events, Mercure and makers.
Package info
github.com/xorgxx/neox-crud-bundle
Type:symfony-bundle
pkg:composer/xorgxx/neox-crud-bundle
Requires
- php: ^8.3
- symfony/event-dispatcher: ^7.3
- symfony/form: ^7.3
- symfony/framework-bundle: ^7.3
- symfony/http-foundation: ^7.3
- symfony/routing: ^7.3
- symfony/yaml: ^7.3
Requires (Dev)
- doctrine/orm: 3.3
- friendsofphp/php-cs-fixer: ^3.64
- minishlink/web-push: ^7.0|^8.0
- phpspec/prophecy: ^1.18
- phpspec/prophecy-phpunit: ^2.0
- phpstan/phpstan: ^1.11
- phpunit/phpunit: ^11.0
- symfony/maker-bundle: ^1.0
Suggests
- pagerfanta/doctrine-orm-adapter: Optional: enable the opt-in live_table with Doctrine ORM (QueryAdapter)
- pagerfanta/pagerfanta: Optional: enable the opt-in live_table pagination
- symfony/mercure-bundle: To enable Mercure subscriber for CRUD events
- symfony/ux-live-component: Optional: enable the opt-in live_table (interactive server-side index table)
- symfony/ux-twig-component: Required to render components() in Twig (dependency of UX LiveComponent)
This package is auto-updated.
Last update: 2026-03-07 10:00:00 UTC
README
NeoxCrudBundle fournit une couche CRUD générique et factorisée pour Symfony. Son objectif est simple: arrêter de dupliquer le même code CRUD dans vos contrôleurs et formulaires, tout en conservant une grande extensibilité via des hooks, des événements et des actions personnalisées.
Features clés:
- Contrôleur CRUD générique pour toutes les routes
/admin/{resource} - CrudHandlers par ressource (Doctrine, formulaires, hooks, actions custom)
- Factory pour résoudre automatiquement le bon handler
- Hooks pre/post create/update/delete
- Événements pour Mercure, audit, logs, etc.
- Maker(s) pour générer handler + form + templates + traductions
- Support des identifiants int|string (UUID/ULID)
Ressources Docs:
- FR: docs/fr/guide.md, docs/fr/config.md, docs/fr/cli.md, docs/fr/uuid.md
- EN: docs/en/guide.md, docs/en/config.md, docs/en/cli.md, docs/en/uuid.md
- Controller: docs/fr/controller.md (FR) / docs/en/controller.md (EN)
- Forms & relations: docs/fr/forms-relations.md (FR) / docs/en/forms-relations.md (EN)
Sommaire rapide:
- Installation (FR/EN)
- Configuration (FR/EN)
- CLI / Maker (FR/EN)
- Cas d’usage
- Sécurité & événements
- Templates & traductions
- Starter kit
Section FR — Installation
- Installer le bundle
composer require neox/crud-bundle
Puis enregistrer le bundle dans config/bundles.php si nécessaire:
return [ // ... Neox\NeoxCrudBundle\NeoxCrudBundle::class => ['all' => true], ];
- Routing générique (config/routes/neox_crud.yaml)
neox_crud: resource: '@NeoxCrudBundle/Controller/' type: attribute prefix: /
Routes exposées automatiquement:
/admin/{resource}/admin/{resource}/new/admin/{resource}/{id}/edit/admin/{resource}/{id}/delete/admin/{resource}/{id}/{action}(actions custom)
- Templates du bundle (optionnel)
twig: paths: '%kernel.project_dir%/vendor/neox/crud-bundle/templates': NeoxCrud
- Configuration (aperçu)
Voir la référence complète: docs/fr/config.md
neox_crud: translations: field_keys: ['label', 'placeholder', 'help'] patterns: placeholder: 'Saisir votre %field_label%' help: 'Aide pour %field_label%' mercure: enabled: true topic_prefix: '/crud'
- CLI / Maker (aperçu)
Voir la référence complète: docs/fr/cli.md
php bin/console make:crud-handler product App\Entity\Product App\Form\ProductType php bin/console make:neox:crud Product
Cas d’usage rapides (FR)
- Lister: utilisez
indexdu contrôleur générique,findList()pour paginer - Créer/Éditer:
new/editetAbstractDoctrineCrudHandler::createForm()+handleForm() - Supprimer:
deleteprotège par CSRF, événements déclenchés - Action custom: implémentez
supportsAction()+handleAction()dans votre handler
Sécurité & événements (FR)
- Par défaut, les routes CRUD sont protégées (ex: #[IsGranted('ROLE_ADMIN')])
- Événements émis: CrudEntitySavedEvent, CrudEntityDeletedEvent
- Intégrations:
CrudNotifierInterface(implémentation par défaut via Mercure)
Templates & traductions (FR)
- Les FormTypes utilisent un
translation_domainpar ressource - Clés standardisées:
product.field.name.label|placeholder|help - Des templates par défaut sont fournis et surchargeables
- Le Maker devine automatiquement le type de champ Symfony à partir du type Doctrine (FQCN en chaîne quand reconnu, sinon
nullpour laisser Symfony deviner). UUID/GUID → TextType par défaut.
Starter kit (FR)
- Exemple complet
Productdisponible dansstarter_kit/ - Voir starter_kit/symfony_project_README.md
Plus d’infos (FR)
- Guide complet:
- Config détaillée:
- Exemples de config:
- CLI détaillée:
- UUID/ULID:
- Contrôleur CRUD générique:
EN Section — Installation
- Install the bundle
composer require neox/crud-bundle
Register in config/bundles.php if needed:
return [ // ... Neox\NeoxCrudBundle\NeoxCrudBundle::class => ['all' => true], ];
- Generic routing (config/routes/neox_crud.yaml)
neox_crud: resource: '@NeoxCrudBundle/Controller/' type: attribute prefix: /
Auto-exposed routes:
/admin/{resource}/admin/{resource}/new/admin/{resource}/{id}/edit/admin/{resource}/{id}/delete/admin/{resource}/{id}/{action}(custom actions)
- Bundle templates (optional)
twig: paths: '%kernel.project_dir%/vendor/neox/crud-bundle/templates': NeoxCrud
- Configuration (overview)
See full reference: docs/en/config.md
neox_crud: translations: field_keys: ['label', 'placeholder', 'help'] patterns: placeholder: 'Enter your %field_label%' help: 'Help for %field_label%' mercure: enabled: true topic_prefix: '/crud'
- CLI / Maker (overview)
See full reference: docs/en/cli.md
php bin/console make:crud-handler product App\Entity\Product App\Form\ProductType php bin/console make:neox:crud Product
Quick use cases (EN)
- List: generic controller
index, pagination viafindList() - Create/Edit:
new/editandAbstractDoctrineCrudHandler::createForm()+handleForm() - Delete:
deletewith CSRF, emits events - Custom action: implement
supportsAction()+handleAction()in your handler
Security & events (EN)
- By default, CRUD routes are protected (e.g. #[IsGranted('ROLE_ADMIN')])
- Emitted events: CrudEntitySavedEvent, CrudEntityDeletedEvent
- Integrations:
CrudNotifierInterface(default implementation uses Mercure)
Templates & translations (EN)
- FormTypes use a per-resource
translation_domain - Standard keys:
product.field.name.label|placeholder|help - Default templates are provided and can be overridden
- The Maker auto-guesses Symfony Form Types from Doctrine types (writes FQCN as string when known, otherwise
nullso Symfony can guess). UUID/GUID → TextType by default.
Starter kit (EN)
- Complete
Productexample instarter_kit/ - See starter_kit/symfony_project_README.md
More (EN)
Notes importantes
- Support des identifiants int|string (UUID/ULID)
- Pas de BC break: respecter les signatures d’interface fournies
- Voir CHANGELOG.md pour les détails de version et migrations