General Information

What is PHP CRUD Generator?

PHP CRUD Generator is a program developed in pure PHP for building complete website administration panels using a visual interface.

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

Quick Start

The "generator" folder is not protected and therefore should not be uploaded to your production server.

  • If you use a local server + a remote server ("production server"):
    Use the local generator to create your admin panel then upload the "admin" folder to your remote server.
  • If you do not use a local server:
    upload the generator to your server but do not let it unprotected.
    Most hosting providers offer simple solutions to protect the folders of your choice using an.htaccess file

Installation process

  1. 1Upload the package content on your server.
    The tree structure must be the one described in the "package structure" section
  2. 2Open the installer - install/index.php - in your browser.
    You'll have to enter your database connection settings for localhost and/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.

CRUD Generator

Main Panel

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

PHPCG Main screen

Read Lists

PHPCG 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

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

Website Admin Panel


Main navigation

Click the Organize Navbar button to open the tool.

You can group the CRUD elements into categories and choose icons for each one.

The navbar structure is registered in admin/crud-data/nav-data.json

Admin panel navbar

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 website 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 previous file (admin/i18n/xx.php)
  3. Open conf/user-conf.php and replace define('LANG', 'en'); with the filename you used previously.
  4. You're welcome to send us your translation, it'll be useful for other users.

Sources & Credits

Many thanks to the authors for their great work


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

version 1.2.4 (07/2018)

        - 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