Simple creation of PHP-CRUD-boilerplate

Following situation: You have some database-tables with a bunch of information in and you need to create all the classes an mechanisms with continously repeating tasks.
For this example, lets take this database with a table for book-information and a fk-referenced table with some ranking-information:

CREATE DATABASE IF NOT EXISTS `book_rankings`;

--
-- table `ranking`
--

CREATE TABLE IF NOT EXISTS book_rankings.ranking (
  id_ranking int(5) NOT NULL AUTO_INCREMENT,
  rank varchar(255) NOT NULL,
  PRIMARY KEY (id_ranking)
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

INSERT INTO book_rankings.ranking (id_ranking, rank) VALUES
(1, 'very good'),
(2, 'good'),
(3, 'bad');

--
-- table `book`
--
CREATE TABLE IF NOT EXISTS book_rankings.book (
  id_book int(5) NOT NULL AUTO_INCREMENT,
  isbn varchar(20) NOT NULL,
  id_ranking int(2) NOT NULL,
  PRIMARY KEY (id_book),
  FOREIGN KEY (id_ranking) REFERENCES book_rankings.ranking(id_ranking) ON DELETE RESTRICT
) ENGINE=InnoDB  DEFAULT CHARSET=latin1;

INSERT INTO book_rankings.book (id_book, isbn, id_ranking) VALUES
(1, '978-3-442-24766-0', 1),
(2, '978-3-442-37954-5', 2);

First: Get phreeze from git: https://github.com/jasonhinkle/phreeze/archive/master.zip (version 3.0 at time of writing) and unpack it to you local dev-environment. I use a local environment with http://www.usbwebserver.net/ where I can test new projects before spreading them out to the world. Other guys like xampp or other packaged environments, but it’s a kind of personal preference.

Unzip the git-export (of course, you can also clone the git-repo, if you like) into the usbwebserver-root-directory and call the builder via localhost: http://localhost/phreeze/builder.

There are only 2 simple steps for boilerplate-creation: in the first step, you have to serve the credentials and information about the database, where the tables are stored.
phreeze_1

In the second and last step, you serve some details about the application to build:
phreeze_2

After that, the builder will produce a zip-file with all the generated files inside. Save this zip and extract it to your local dev-environment from where you can call it via localhost:
show_books

From their you can do all the basic CRUD-operations like adding ranking-values:
add_rankings

or changing an existing book with simple foreign-key-dropdowns:
edit_books

conclusion: nice framework for fast creation of CRUD-views. Of course that’s not all and so there is a basic authentication-mechanism generated with role-based-logins. More about this topic can be read at the project-site: http://phreeze.com/ It’s a nice, simple and easy framework and the generated files and structures are well documented, so modification of initially generated code is quite easy.

references: