PHP Classes
elePHPant
Icontem

Usetiful: Generate DAO classes to access objects in MySQL

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files View files (3)   DownloadInstall with Composer Download .zip   Reputation   Support forum (1)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2013-09-03 (1 year ago) RSS 2.0 feedNot yet rated by the usersTotal: 255 This week: 1All time: 7,107 This week: 996Up
Version License PHP version Categories  
usetiful 1.0MIT/X Consortium ...5.1PHP 5, Databases, Code Generation
Description Author  

This class can generate DAO (Data Access Object) classes to access objects in a MySQL database.

It takes the name of a MySQL database and generates classes to access objects stored in the tables of that database performing CRUD (Create, Read, Update and Delete) operations.

It can generate classes just to access a single database table.

The generated classes are stored in a given project directory and include classes for performing CRUD operations, business classes with getters and setters, DAO utility functions, database connection functions, sending email, generating HTML, handling exceptions, and perform server side validation.

Picture of Alberto Belotti
Name: Alberto Belotti <contact>
Classes: 1 package by
Country: Italy Italy
Age: 33
All time rank: 3593147 in Italy Italy
Week rank: 812 Up38 in Italy Italy Up

Details provided by the author  
usetiful - Php / Mysql Dao Generator
========================================

What Usetiful?<br/>
Usetiful is a beatiful useful class generator for Php / Mysql.
It allows you to create the classes for Create, Read and Update Mysql records.

Why Usetiful?<br/>
The main purpose is to avoid writing many lines of code, saving your time.

How Usetiful?<br/>
it's really easy to use. Download the zip file, extract it to the root where you want. 

The Steps are the following:

- create a simple Php file (see the example below);
- include usetiful class (file you have downloaded);
- istantiate the object passing all the required variables in the constructor;
- enjoy your created classes! ^_^

================

Example:

<?php<br/>
include_once 'usetiful.php';<br/>
$server = "127.0.0.1"; //where your db is...<br/>
$username = "root"; //db username<br/>
$password = ""; //db password<br/>
$schema = ""; //db name / schema<br/>
$project_name = "folder1"; // where you would like to create your project folder <br/>
$mp = new Usetiful($server, $username, $password, $schema, $project_name, $table = false);<br/>
?>

IMPORTANT: For the correct execution of Usetiful you must have the mysql priviliges to select information_schema and possibly you should have administrator privileges of the webserver (also local)


Usetiful creates a folder containing some files (the first 3 are the fundamentals layers):

- Class.Actions.php
- Class.Business.php
- Class.Persistence.php
- Class.DaoUtils.php
- Class.Email.php
- Class.Html.php
- Class.Trigger.php
- Class.Validation.php
- Constants.php

It also creates one folder for each mysql table found containing a sample index.php page that shows you how easy it is now to create a select statement (just done).

Usetiful - files created.
Class.Actions.php: This is the entry point. There are the methods to perform CRUD any calls or other. By instantiating the Action object you'll get what you need.

Class.Business.php: Classes accompanied by their respective getters and setters methods already written. Beautiful is not it?

Class.DaoUtils.php: Connection to db. At the moment is still used the connection method mysql_connect. Will be replaced in the shortest possible time.

Class.Email.php: Send emails based on standard class Mail php.

Class.Html.php: A very small html framework that might be useful to build pages quickly.

Class.Persistence.php: The class that contains the heart of the application. Contains the CRUD (CRU) and some methods for queries.

Class.Trigger.php: A support class that could serve for handling exceptions

Class.Validation.php: A class designed for server-side validation of the fields. Not fully implemented yet.

Constants.php: A small class of constants. 



  Files folder image Files  
File Role Description
Accessible without login Plain text file LICENSE Lic. MIT License
Accessible without login Plain text file README.md Data Readme file
Plain text file usetiful.php Class Class source

 Version Control Unique User Downloads Download Rankings  
 100%Total:255All time:7,107
 This week:1This week:996Up
 User Comments (1)  
 
good
1 year ago (Rahul Shambharkar)
60%StarStarStarStar