Press "Enter" to skip to content

Phreeze: how to get it set up and running

codingfix 0

Warning: Use of undefined constant cf - assumed 'cf' (this will throw an Error in a future version of PHP) in /homepages/30/d750307607/htdocs/clickandbuilds/Codingfix/wp-content/plugins/embedit-pro/embed-it-pro.php on line 95

Warning: Use of undefined constant snippet - assumed 'snippet' (this will throw an Error in a future version of PHP) in /homepages/30/d750307607/htdocs/clickandbuilds/Codingfix/wp-content/plugins/embedit-pro/embed-it-pro.php on line 103

Warning: Use of undefined constant snippet - assumed 'snippet' (this will throw an Error in a future version of PHP) in /homepages/30/d750307607/htdocs/clickandbuilds/Codingfix/wp-content/plugins/embedit-pro/embed-it-pro.php on line 105

Phreeze is an amazing application generator which allows to have an entire database management application built just in minutes.

Sometime ago I was working for a customer who, for reasons I couldn’t know, didn’t want give me a full access to his hosting provide control panel. That’s was not a big issue: in fact I could do the most part of work just using an FTP client. But the database management was difficult having to always give sql dump files to my customer and then wait that he performed the queries against the database.

I couldn’t even use a remote database management software like MySql Workbench, because the hosting provider didn’t allow that.

So I have finally decided to look for a solution which give me a workaround to all these difficulties and allowed me to directly perform all CRUD operations without having to interact with the customer. This way I have discovered Phreeze.

As authors say:

Phreeze is a framework for building PHP applications. A framework is basically a toolkit of helper classes along with a consistent application structure.

Phreeze is comprised of three components. The one we’ll look at in this small guide is Phreeze Builder:

…is a utility that analyzes a database and auto-generates a basic application that is ready to use and/or customize.

What I want is just to show you how to build  a basic database management application with Phreeze Builder, beacuse it tooke me a bit of time before to get it working (probably because I’m a bit stupid, but we can ignore that for the moment…)

Getting started

First, go to https://github.com/jasonhinkle/phreeze and download the compressed file to your machine, then uncompress it in a convenient location.

tm_en_970x90

You should now have in your target directory a folder called phreeze-master which holds all application files: I suggest you to rename it to phreeze (just to avoid issues with internal links) and to upload it to your server (let’s call it www.mydomain.com).

Now, use your browser of choice to visit www.mydomain.com/phreeze/builder.

If you get some error (as it happened to me), you have to open the .htaccess you find in phreeze/builder directory and uncomment the
RewriteBase rule, that is replace this line:

with this one:

Maybe you still get an error about timezone settings: if this is the case, open in your code editor the file phreeze/builder/_machine_config.php and uncomment following line

in order to have:

Running the Builder

Now navigating to http://www.mydomain.com/phreeze/builder you should correctly access the builder wizard. In the first page you have to put your connection data: database host, username, password, database name and the type of mysql connection (mysql, mysqli or PDO).

Phreeze BuilderWhen you have done, just click Analyze Database button.

Using the Analyzer

The next page shows you a complete list of your database tables (if you don’t want some table be managed by your application, just uncheck it) and ask you to adjust some more settings:

Phreeze AnalyzerHover your mouse over the question marks to get a quick and clear explanation of the option; below I report them here showing my settings:

Accordion test

If you want to know how to build an accordion like this one with a few lines of code you can read my article The simplest jQuery Accordion ever!

Generating the application

And now we can finally click the Generate application button. Depending on the size of your database, after some time your browser will download an archive with your application. Uncompress this archive in the choosen directory (in our example it was ‘db_admin’, do you remember?).

I’ts almost done. We have just to repeat some steps we did above to configure Phreeze Builder:

  1. open the .htaccess file in your /db_admin/ directory and set the value of RewriteBase rule correctly: RewriteBase /dbman/
  2. then open the _machine_config.php file in your /db_admin/ directory and set the timezone: date_default_timezone_set("UTC");

Now you can visit the URL  www.mydomain.com/db_admin and start to manage your database!

Warning. Browsing through your database you could find that not always table has all columns you would expect to see: that’s strange and it took me a bit to discover the issue. Since I’m a generous man, I want to reveal the secret right now! By default, Phreeze applications doesn’t show more than 5 columns per table. To change this, you have to open /db_admin/templates/ directory and look for the template which refers to the table you want to show more columns (virtually all of them) and open it in you code editor of choice. Around line 30 you’ll find something like this:

Okay: just do what they say and “UNCOMMENT TO SHOW ADDITIONAL COLUMNS” 🙂

Hope this help

    Leave a Reply

    Your email address will not be published. Required fields are marked *