Download the PHP package jeandanyel/crud-bundle without Composer
On this page you can find all versions of the php package jeandanyel/crud-bundle. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download jeandanyel/crud-bundle
More information about jeandanyel/crud-bundle
Files in jeandanyel/crud-bundle
Package crud-bundle
Short Description A flexible Symfony bundle that provides automatic generation of Create, Read, Update, and Delete actions for entities, along with list management and customizable templates.
License MIT
Informations about the package crud-bundle
crud-bundle
The CRUD Bundle provides a quick and easy way to generate Create, Read, Update, and Delete actions for any given entity in your Symfony projects. This bundle is designed to simplify entity management by automating CRUD operations while remaining flexible and easy to customize.
Additionally, it integrates list generation through the jeandanyel/list-bundle, offering a customizable solution for displaying and managing your data.
This bundle is actively under development, with upcoming features such as role management and event handling. Contributions to the project are always welcome 🥳.
Usage
To use this bundle, simply create an Entity, its corresponding Repository, a FormType, a ListType and a Controller that extends the abstract class AbstractCrudController
.
Use the CrudController
attribute to specify the Entity, FormType, and ListType classes as parameters.
This configuration will automatically set up CRUD actions for the Article
entity.
Routes
The routes for the CRUD actions are automatically generated by the bundle using the RouteLoader
. This means you don't have to manually configure the routes for each entity.
Templates
The bundle provides default templates used for the list
, create
, and update
actions.
If these templates do not meet your needs, you can create your own custom templates by following the naming convention based on your entity and the desired action. Your custom template will take priority over the default ones.
The format to follow for your custom templates is templates/{entity}/{action}.html.twig
.
For example, if you want to create a custom template for the Article
entity and the update
action, the Twig file should be created at templates/article/update.html.twig
.
CRUD actions list
Method | Route name | Route | Template |
---|---|---|---|
AbstractCrudController::list |
crud_{entity}_list | /{entity}/list | @JeandanyelCrud/crud/list.html.twig |
AbstractCrudController::create |
crud_{entity}_create | /{entity}/create | @JeandanyelCrud/crud/create.html.twig |
AbstractCrudController::update |
crud_{entity}_update | /{entity}/update/{id} | @JeandanyelCrud/crud/update.html.twig |
AbstractCrudController::delete |
crud_{entity}_delete | /{entity}/delete/{id} | - |
Events
The CRUD includes events that allow developers to hook into specific CRUD actions, such as saving an entity. These events are dispatched during CRUD operations and can be used to perform additional logic or validations.
Available events
Event Name | Description |
---|---|
EntityBeforeSaveEvent |
Triggered before an entity is saved to the database. |
EntityAfterSaveEvent |
Triggered after an entity has been saved to the database. |
Usage example
The following example demonstrates how to use EntityBeforeSaveEvent
to perform operations before an entity is saved:
All versions of crud-bundle with dependencies
doctrine/dbal Version ^3
doctrine/doctrine-bundle Version ^2.12
doctrine/orm Version ^3.1
symfony/translation Version ^6.4 || ^7.1
symfony/asset Version ^6.4 || ^7.1
symfony/form Version ^6.4 || ^7.1
symfony/framework-bundle Version ^6.4 || ^7.1
symfony/twig-bundle Version ^6.4 || ^7.1
twig/twig Version ^2.12|^3.0
jeandanyel/list-bundle Version ^0.1