About CRUD Operations

What is PHP CRUD Generator?

PHP CRUD Generator is a program developed in pure PHP for building your complete Bootstrap administration panel using a visual UI.

PHPCG is suitable for both non-programmers and advanced PHP programmers, who will have access to a clean and well organized code so they can take advantage of all its potential.

PHPCG is able to analyze your database, extract tables, fields and any type of relationship intelligently.

The analyzed db data can then be used to generate your user administration panel:


Database, Tables & Relations

PHPCG analyzes your database intelligently.

Your tables and fields must therefore respect the standards:

  • names in lower case letters, numbers and underscore (_)
  • consistent field types based on data
  • one-to-one, one-to-many and many-to-many relationships

Package Structure

Required on your production server

Quick Start

About Local & Production workflow

The "generator" folder is only required to build & edit your Bootstrap admin panel.

  • If you use a local server + a remote server ("production server"):
    You can either:
    • use the local generator to create your admin panel then upload the "admin" and "conf" folders to your remote server.
    • create the admin panel directly from your production server.
    The 2nd way is the recommended method.
  • If you do not use a local server:
    the generator folder is required on your server.

Installation process Open the Tutorial

  1. 1Upload the required* folders on your server as described in the "package structure" section
  2. 2Open the installer - install/index.php - in your browser.
    If you use a local server + a remote server, you must run the installer on both.
    More informations available at the Installation/Registration section

    You'll have to enter your database connection settings for localhost or production server + basic general informations.
  3. 3 All is now ready to generate your admin panel using the CRUD Generator.
    Open the generator - generator/generator.php - in your browser.


If you use a local server + a remote server, you must run the installer on both.

What does the installer do?

The installer:

  • Tests your server compatibility (PHP Version, available modules, white rights, ...)
  • Tests & register your database connection credentials
  • Checks & registers your license
  • Creates a MySQL table named "user_data" with your license settings

If you need to reinstall, or have any question/issue with the installation/registration:

  1. Have a look at the video tutorials in the Tutorials
  2. Have a look at the "How To" & "Troubleshooting" sections in the Help Center
  3. Contact me if you still need help


CORE configuration

Don't change anything here unless you know what you're doing.

USER configuration (General Settings)

This file contains some global settings that can be customized

To change these settings open the Generator in your browser and click the General Settings button.

Allows to lock/unlock the generator access.
If the generator is locked, access is protected by an identification page. You will need to enter your email & your purchase code to access it.
Protects the Bootstrap Admin Panel access with a login page if enabled.
The Authentication module must be installed.
This setting can be changed in the Generator page.
The main title displayed in the Bootstrap Admin Panel header
The image displayed at the top left of the Bootstrap Admin Panel header.
The image file MUST be in the admin\assets\images\ folder.
Position of action buttons (update, delete) in the admin READ lists.
Can be ' left' or 'right'
Enable filters in the admin lists as soon as a filter is selected in the drop-down list instead of clicking the filter button
The Bootstrap Admin Panel language.
The translation file MUST exist in /admin/i18n/
Date & time translations for the Bootstrap Admin lists
Date & time pickers style (Default or Material Design)
Date & time pickers translations for the Bootstrap Admin forms.
The language files are located in:
  • class/phpformbuilder/plugins/pickadate/lib/compressed/translations/ for default style (pickadate plugin)
  • class/phpformbuilder/plugins/material-datepicker/dist/i18n/ for Material Design style (material-datepicker plugin)
Security level of passwords required for creating user access.
The different configurations are available here: Passwords available patterns
Choose if the sidebar of the admin panel behaves like drop-down lists or accordion lists.

Admin Panel Skin (Admin Panel Bootstrap CSS)

Bootstrap CSS classes for the Admin Panel can be customized using the General Settings form

CRUD Generator

Protect access to the Generator with a login page

To protect access to the generator:

  1. Open the Generator in your browser
  2. Click the General Settings button to open the form
  3. Set Lock the Generator to true
  4. Done - when you open generator/generator.php in your browser you'll be redirected to the login page.
    Enter your registration email & your purchase code to login.

Main Panel

Choose your database in the dropdown list and validate. You will then see the complete panel appear.

PHP CRUD Generator Main screen

Read Lists

PHP CRUD Generator Read Lists

Lists filters

Add Filter

Click the "Add Filter" button in the Read Lists generator form to add a new filter.

This will add a new filter to your list.

PHPCG offers you 2 types of filters:

Simple filters

You just have to choose the field to filter in the dropdown list.

Advanced filters

Advanced filters are useful:

  • if you want to display 2 or more values in the admin dropdown list.
    For example the first and last name are displayed and the filtered value is the ID.
  • if you want to filter values from external relationships.

To use advanced filters it is necessary to enter query parameters with joins.

A help button is available to help you build your query, as well as a preview button that allows you to view the generated drop-down list and check its validity.

To build your requests we recommend the excellent software FlySpeed SQL Query

Create/Update Forms

PHPCG Create/Update Forms

Delete Forms

PHPCG Delete Forms

Admin User Authentification Module

The User Authentification Module installer allows you to configure the rights access to the admin items. It must therefore be installed last, after having created all the elements of the CRUD.

Click the Install User Authentification Module button to launch the installer.

The installer will create the users and the users_profiles tables

You will also have enter the main administrator informations.

The main administrator can then manage users and profiles in the admin panel.

If you have to re-install the User Authentification Module:
- Delete admin/secure/install/install.lock from your server
- launch the installer

phpcg authentification module installer

Bootstrap Admin Panel


Customization for advanced users

If your database structure changes along the way, PHPCG is able to rebuild the data and allows you to regenerate the corresponding CRUD pages.

When generating administration panel pages, PHPCRUD automatically keeps a backup of the previous version.

The file comparison tool integrated with the generator allows you to compare side by side your current version and the previous one, and to merge them by choosing the code blocks to be retained.

Administration customizations can thus be retained during version/structure changes.

Update instructions

Updates are automatic.

When a new version is released, you'll see the "New PHP CRUD GENERATOR version is available" message in /generator/generator.php and will just have to click the "Install" button.

Your version number is available in /conf/conf.php (VERSION)

Special update from version 1.0 (first release)
  1. Copy /generator/update folder to /generator/update on your server.
  2. Open generator/update/first-update.php in your browser.
    This will install /vendor folder on your server and replace /generator/generator.php with the new version included in this package.
  3. Open /generator/generator.php in your browser and click the Install button.
  4. The automatic installer will start make the update

Languages/Translation (I18n)

PHP CRUD Generator and the generated Bootstrap admin panel are both fully multi-language.

To translate to your own language:

  1. Duplicate admin/i18n/en.php and rename it to your own language.
  2. Make the translations inside the file that you created (admin/i18n/[your-language].php)
  3. Open conf/user-conf.php and replace define('LANG', 'en'); with the filename you used previously.
  4. Check class/phpformbuilder/plugins/select2/dist/js/i18n/[your-language].js and create it if it doesn't exist.
  5. You're welcome to send us your translation, it'll be useful for other users.

PHP Form Builder

PHP Form Builder is included in the package and you can use it without restriction on the same domain as your CRUD.

This means that you can build any form you want on your website/project and use the integrated plugins & functionalities.

To use PHP Form Builder in your project, include the main conf file on your page add this code at the beginning of your file:

use phpformbuilder\Form;

include_once include_once rtrim($_SERVER['DOCUMENT_ROOT'], DIRECTORY_SEPARATOR) . 'conf/conf.php';
include_once CLASS_DIR . 'phpformbuilder/Form.php';

Then you can build your forms. Documentation is available on the official website: https://www.phpformbuilder.pro

Sources & Credits

Many thanks to the authors for their great work


After any update, close & reopen your browser to clear PHP SESSION

version 1.7.1 (08/2019)

Bug Fix:
    - Fix the Admin Dropdown Search field cross-browser compatibility
      (rebuild your lists to apply)

version 1.7 (08/2019)

New Features:
    - New live search with Ajax Autocomplete for Bootstrap Admin Panel READ lists
      (rebuild your lists to apply)
    - Update Material Pickers for compatibility

version 1.6.1 (07/2019)

New Features:
    - Admin filters now can deal with JSON array values (select multiple, checkboxes)
    - New PHP CRUD Generator Tutorials channel on Youtube: https://www.youtube.com/channel/UCo1PBjNNOWUQrfNRqjLz6LQ
    - Array values from database now displayed as comma-separated values instead of raw JSON
    - improve the online Documentation & Tutorials
Bug Fix:
    - Rewrite code to limit users rights to their own records
      (rebuild your lists / forms to apply)

version 1.6 (06/2019)

New Features:
    - 20+ new Bootstrap themes are now available
    - Choose your prefered Bootstrap theme from the General Settings form
    - Customize all the main layout Bootstrap CSS classes from the General Settings form
    - Compile the SASS files with Gulp using the new PHP CRUD Generator Gulp Github repository - https://github.com/migliori/php-crud-generator-gulp
    - New tutorial for Admin Theming & CSS: https://www.phpcrudgenerator.com/tutorials/how-to-customize-the-bootstrap-admin-panel-css
Bug Fix:
    - Great, no known bug!

version 1.5.6 (06/2019)

    - The General Settings form in the generator now allows to change the Bootstrap admin main body class
Bug Fix:
    - the installer was broken by the previous changes. Solved now.
    - Edit in place is no more available in Admin READ lists for users with insufficient rights
    - the broken "enable/disable" authentication module in the Generator now works again

version 1.5.5 (06/2019)

New Features:
    - The date & Time pickers languages can now be defined in the General Settings form
    - You can now choose the style of the Bootstrap admin date & Time pickers
      (default | Material Design)
    - New Italian translation - Many thanks to Alberto

version 1.5.4 (06/2019)

New Features:
    - New General Settings form available in the Generator
    - The action buttons of the Bootstrap Admin panel can now be on the left or right of the table
    - The filters of the Bootstrap Admin panel can now be triggered automatically when selected
    - You can change the site title and admin logo using the General Settings form
    - You can change the admin language using the General Settings form
    - You can change the admin skin using the General Settings form
    - Show custom table names in Admin READ lists nested tables
Bug Fix:
    - The Validation button in the Generator should now never overlap the forms

version 1.5.3 (06/2019)

New Features:
    - Action buttons in the admin panel can now be displayed in the
      1st column of the admin READ lists
    - Responsive & others in admin CSS
Bug Fix:
    - datepicker plugin
    - files & images upload
    - tooltips
      (these bugs were due to the previous update with latest PHP Form Builder)

version 1.5.2 (05/2019)

Bug Fix:
    - fix sorting buttons in admin panel READ lists

version 1.5.1 (05/2019)

Bug Fix:
    - fix export to excel/csv in admin panel

version 1.5 (05/2019)

New Features:
    - replace PHP Form Builder with the latest version 4.2.1
    - Admin Panel Fast Loading optimization with the new LoadJS features
    - PHP CRUD Fast Loading optimization with the new LoadJS features
    - rewrite queries for admin restricted users rights
    - upgrade Bootstrap to the latest version 4.3.1
    - minor various others improvements

version 1.4.9 (05/2019)

New Features:
    - add new Export features (print - current view - all records) in admin READ lists

version 1.4.8 (02/2019)

New Features:
    - add (very) strong protection for fileuploader plugin uploads
Bug Fix:
    - remove some PHP warnings
    - solved admin sidebar duplicate items issue

version 1.4.7 (02/2019)

Bug Fix:
    - fix navbar issue with empty icons

version 1.4.6 (02/2019)

New Features:
    - New "array" field type in generator for checkboxes & select multiple values
      will show JSON decoded values in the READ lists
    - better admin navbar content management ("Organize Navbar")
    - improve array values management in the generator
Bug Fix:
    - fix non-working select multiple with "set" & "enum" field types
    - fix changelog url in auto-update success message

version 1.4.5 (02/2019)

New Features:
    - License system now accepts domain with multiple extensions
      ie: domain.com, domain.eu, domain.co.uk are all valid with the same license.
    - New button in the Generator to reload fresh database structure
      (When you add or remove tables)
Bug Fix:
    - admin filters now accept zero values
    - fix queries in admin lists on external tables with direct relation (no intermediate table)

version 1.4.4 (02/2019)

New Features:
    - external records from relational tables can now be managed
      from the READ LISTS & the CREATE/UPDATE forms (!)
    - add self-referential foreign keys management
    - tables can now be removed/re-enabled from the admin navbar
    - add Spanish admin translation (Thanks to Sergio)
    - export buttons (csv/xls[x]) now export the exact filtered list items
    - align single fields on the left in admin panels

Bug Fix:
    - remove phone validation in auth. module installer
    - logout from generator/generator.php now does its job as intended
    - upgrade PHPMailer to latest 6.0.6 to fix PHP 7.3 warnings

version 1.4.3 (12/2018)

Bug Fix:
    - fix inverted label & value in form CREATE/EDIT templates
    - protect relation tables SELECT queries in form CREATE/EDIT templates

version 1.4.2 (10/2018)

New Features:
    - new "Add New" button in admin READ lists on external nested tables even if no record
    - ADMIN panel: register URL query parameters in $_GET (Altorouter ROUTES doesn't deal with these).
    - the ADMIN ADD & UPDATE forms now redirect to the correct list if we come from a nested table (external relation)
    - move date_default_timezone_set from conf/conf.php to conf/user-conf.php
    - add Help & instructions for Microsoft IIS & NGINX servers
Bug Fix:
    - "Add New" button in admin READ lists now always targets the right CREATE form
       even if there's several external nested tables in the list.
    - Fix several warnings & minor issues

version 1.4.1 (10/2018)

New Features:
    - add "Add New", "Edit" & "Delete" buttons in READ Lists nested tables for external tables records
    - add compatibility for date & time without PHP intl extension
Bug Fix:
    - definitely fix the Apache mod_security error on the install process with some misconfigured servers

version 1.4 (10/2018)

Warning: If you admin READ lists have date or datetime fields, open the corresponding templates in /admin/templates, find the functions toDate(...) and replace the date PHP format with the corresponding ICU date format.

new online PHP CRUD Tutorials

New Features:
    - PHPCG includes now the complete latest PHP Form Builder version with all its features & plugins.
    - Add the online knowledge base with numerous tutorials & videos
    - improve date & time translations management - https://www.phpcrudgenerator.com/tutorials/how-to-translate-dates-times-in-admin-panel
    - add full date & time translation in admin lists & forms
    - change admin form action from absolute url to root relative url
    - add install/curl-test.php to help with CURL debbuging
Bug Fix:
    - the generator now retrieves the correct stored values to be displayed in READ lists for the external fields
    - get the correct time value in admin edit forms with datetime fields
    - solve plugins URL detection with paths containing uppercase letters

version 1.3.2 (08/2018)

    - dates edit in place now get the current field value
    - image now crop from the center
Bug Fix:
    - fix missing fields in update forms due to previous update error
    - fix admin lists bug with fields having uppercase characters
    - fix admin edit in place with dates & uppercase table name

version 1.3.1 (08/2018)

Bug Fix:
    - fix Generator form create profiles

version 1.3 (08/2018)

        - After this update you may have to reinstall the user authentification module from the Generator page.
    - update server-side validation functions to accept empty values,
            except for the validators whose internal logic make values required.
            Details available here: https://www.phpformbuilder.pro/documentation/class-doc.html#php-validation-methods
    - the User Authentification Module now keeps the users & users profiles tables and records when uninstalling.
    - the User Authentification Module can now be reinstalled even if the users & users profiles table exist
    - improve user profiles management and rights limitations
    - the users rights changes now take effect without clearing the session
    - the admin sidebar doesn't show empty categories anymore
    - the only required fields in users table are now name, firstname, profile ID, email, pass & active
      (takes effect on new User Authentification Module installs only)
    - add simulate property to Generator.php to simulate when we reset a table structure from generator
    - remove several warnings & improve various feedback messages
Bug Fix:
    - solve problem with updates & SSL errors on misconfigured servers

version 1.2.4 (07/2018)

        - After this update you may have to reinstall the user authentification module from the Generator page.
        - set default empty value for passwords in UPDATE FORMS
Bug Fix:
        - solve CREATE/UPDATE forms generation with custom validation
        - solve READ LISTS generation with advanced filders
        - solve image path in admin when the field thumbs are not enabled
        - remove password validation in UPDATE FORMS if posted value is empty
        - correct select values count in generator CREATE/UPDATE forms with custom values
        - solve error 500 when adding new users

version 1.2.3 (07/2018)

New Features:
        - add an uninstallation process
        - add a login module for the generator on the production server
        - primary key management in admin forms
        - remove the "select database" form in generator & auto select the correct database
        - add warnings for non-standard tables & field names (hyphenated)
        - improve password fields management in CREATE/UPDATE forms:
          better password encryption with Secure class
          password are now automatically optional on update forms with an helper text: "Leave blank to keep the current password"
        - turn fileuploader debug on for CREATE/UPDATE forms
        - improve documentation
        - improve auto-validation detection according to forms & database field types
Bug Fix:
        - revert Twig template engine to version 1.35.4 to preserve PHP < 7.0 compatibility
        - regenerate css & js combined plugin files for CREATE/UPDATE forms when the forms are edited with the generator
        - fix generator which failed to validate when custom validators were selected while generating the CREATE/UPDATE forms
        - fix password encryption when changes are made in CREATE/UPDATE users table

version 1.2.2 (07/2018)

        - add user-conf file to avoid breaking user custom settings with updates
        - move the install folder outside the generator folder.
        - improve the updater script
        - improve url & path management
Bug Fix:
        - fix server issues in some special configurations

version 1.2.1 (07/2018)

Warning: if your authentification module is not enabled, after the update open php-crud-generator/conf/admin-lock.php and set ADMIN_LOCKED to false.

        - move ADMIN_LOCKED and ADMIN_LOGO to separate files for easier updates
Bug Fix:
        - fix several minor bugs

version 1.2 (06/2018)

Bug Fix:
        - fix authentification module installation (wrong users filters)

version 1.1 (06/2018)

New Features:
        - add File uploader to Generator + Admin panel
        - add version check & auto-updater
        - update dependencies & move to vendor with Composer
        - improve ROOT path analysis
Bug Fix:
        - correct date & time validation
        - correct value/display inversion with live-edit custom select

version 1.0 (06/2018)

First Release