Phreeze Builder

Phreeze Builder is a utility that analyzes a database and auto-generates a basic application that is ready to use and/or customize. Phreeze builder uses templates to generate different types of applications.

Database Schema Recommendations

Phreeze can work with just about any existing schema. However if you are starting from scratch then you can optimize your schema for Phreeze by following a few simple naming conventions:

Running Phreeze Builder

Phreeze builder is included withe the Phreeze library and is located in the /builder/ sub-directory. Assuming you have saved the /phreeze/ folder in your localhost web root, you can open Phreeze builder at the following URL:


The first screen of the builder application will ask for your MySQL connection settings. Providing these settings will do two things: first the builder app will connect and analyze your schema and second, it will re-use this information to create a _machine_config.php file in the generated application. This way your generated application will be ready to run without editing any config files

Once you have entered your database information, you will see the results of the schema analysis. You should review all of the singular and plural names that were calculated by the builder app and make any adjustments. The builder attempts to guess appropriate names for your model classes, however it doesn't alwasy guess nuances of spoken language and may need your corrections.

Below the table names is a drop-down to select the application that you wish to geneate. You can choose from various template engines based on your personal preferences, generate a unit test harness or generate only the model files for your schema.

There are additional options below this where you can specify the name of your application, the root URL where this application will exist and the relative path to the /phreeze/libs/ directory.

Once you are satisfied with your settings, click the "Generate Application" button and you will be prompted to download a .zip file. This .zip file contains all of the files needed for your application.

Running Your Generated Application

Depending on the path and root URL you specified, you should expand your application .zip file in the appropriate location on your server. If you selected Smarty as your template engine then you may need to configure the permissions of the /templates_c/ directory to allow write permissions. If you selected the Laravel/Blade template engine then you may need to alter the permissions on /storage/views/ to allow writing.

Once the appliation is installed on your server and optionally the permissions have been updated you are ready to run your application. Open your browser to the appropriate location such as:


If all has gone according to plan then you should see your application welcome screen!

Customizing Phreeze Builder Templates

The applications that are generates by Phreeze Builder are based off of Smarty templates located in the phreeze/builder/code/ directory. Each application consists of two parts: a 'config' and one or more templates. The builder app looks for *.config files in the /code/ directory. If you open an existing config file you will see a [parameters] section for application name and description following by a [files] section for template files. The files section lists the source template that will be used and their destination in the generated application. For example:

phreeze.backbone/libs/Controller/Controller.php.tpl	libs/Controller/{$singular}Controller.php	0
phreeze.backbone/index.php.tpl	index.php	1
phreeze.backbone/bootstrap/css/bootstrap-combobox.css	bootstrap/css/bootstrap-combobox.css	2

The first column in the list is the name of the source template file. The second column is the "destination" for the resulting file(s) in the generated application. The file name of the destination may contain placeholders such as {$singular} or {$plural} which means this will be replaced with the table singular or plural name. The name can be forced as all lower-case using a Smarty modifier such as {$singular|lower}.

The third column is either 0, 1 or 2 and refers to the method to use when parsing the template:

  1. A template will be parsed and generated for each table in the database
  2. A template will be parsed and generated only once for the application (for example index.php)
  3. A template will be copied as-is without parsing (images, script libraries, etc)

The best way to get started with your own applications is by looking into the source of some of the existing appliations. Within each tempalate you can loop through tables and columns as well as access meta information about the database schema.