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:

Requirements

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

Legend:
*
Required on your production server

Quick Start

About Local & Production workflow

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


  • If you use a local server + a remote server ("production server"):
    You can use the local generator to create your admin panel then upload the "admin" folder to your remote server.
    OR create the admin panel directly from your production server.
  • If you do not use a local server:
    the generator folder is required on your server.

Installation process

  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 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.

Installation/Registration

If you use a 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
  • Check & register 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 "How To" & "Troubleshooting" sections in the Help Center
  2. Contact me if you still need help

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

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

Website Admin Panel

Structure

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

Changelog

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

version 1.3.2(08/2018)


Improvements:
    - 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)


Improvements:
Bug Fix:
    - fix Generator form create profiles

version 1.3 (08/2018)


Notes:
        - After this update you may have to reinstall the user authentification module from the Generator page.
Improvements:
    - 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)


Notes:
        - After this update you may have to reinstall the user authentification module from the Generator page.
Improvements:
        - 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
Improvements:
        - 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)


Improvements:
        - 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.


Improvements:
        - 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
Improvements:
        - 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