Loading...
Loading...

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

  1. laminas/laminas-cache
  2. laminas/laminas-paginator-adapter-laminasdb

Required Laminas Starter Kit Components

  1. mariadb-database-connect

On-line Generator

Setup Instructions

  1. Ensure you have module called: %module% in your application.
  2. Copy contents of %name%Table.php to: [root]/module/%module%/src/Model/%name%Table.php.
  3. Copy to the same location as above the file: AbstractTable.php.
  4. Copy contents of %name%.php to: [root]/module/%module%/src/Model/Rowset/%name%.php.
  5. 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
  6. All the view files (.phtml) place under new added folder of: [root]/module/%module%/view/%viewFolderName%/
  7. 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:

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

Learn more with Laminas Book:

Laminas MVC: the most innovative framework in PHP - get a book on Amazon

Need help? Checkout our setup page, video tutorials or ask questions on our forum!

Help Tutorials Forum
TOP