CRUD Generator
generate a full working CRUD module
crud-generator
Generate your sample Laminas CRUD for given module and name. Pass a list of elements to populate desired fields.
Video Tutorial
Required Laminas Components
- laminas/laminas-cache
- laminas/laminas-paginator-adapter-laminasdb
Required Laminas Starter Kit Components
On-line Generator
Setup Instructions
- Ensure you have module called: %module% in your application.
- Copy contents of %name%Table.php to: [root]/module/%module%/src/Model/%name%Table.php.
- Copy to the same location as above the file: AbstractTable.php.
- Copy contents of %name%.php to: [root]/module/%module%/src/Model/Rowset/%name%.php.
- Copy the form file of %name%Form.php into forms locations (create one if you do not have it yet) [root]/module/%module%/src/Form
- All the view files (.phtml) place under new added folder of: [root]/module/%module%/view/%viewFolderName%/
- Finally, copy the new configuration file generated.crud.%name%.php into [root]/module/%module%/config/
Throubleshooting
Make sure your application contains all the required plugins from "Required Laminas Components" and "Required Laminas Kit Components".
You can learn how to add missing dependencies in this video:
You can learn how to add missing dependencies in this video:
Parameters
Param name | Type | Default value | Description |
---|---|---|---|
name | text | NULL | Sets a crud name |
module | text | NULL | Sets a module name |
properties | array | NULL | Sets crud's table properties |
CLI Usage
"vendor/bin/laminas.bat" mvc:crud --properties=<tableProperty1> --properties=<tableProperty2> --module=<moduleName> <name>
Example Usage
"vendor/bin/laminas.bat" mvc:crud --properties=name --properties=email --properties=gender --module=Application Users