PHP Classes
elePHPant
Icontem

MySQL Class Generator: Generate classes to access MySQL as objects

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (37)   DownloadInstall with Composer Download .zip   Reputation   Support forum (4)   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2019-06-14 (2 months ago) RSS 2.0 feedStarStarStarStarStar 80%Total: 582 This week: 5All time: 5,198 This week: 56Up
Version License PHP version Categories
mysqlreflection 1.0.10BSD License5PHP 5, Databases, Code Generation
Description Author

This package can perform automatic generation of PHP classes from MySQL tables.

It is able to access to a given MySQL database and retrieve schema tables and fields.

For each table it generates a class that provides methods for accessing, reading and writing its records by using object oriented programming logic.

Each generated PHP class provides Setter and Getter methods for all table fields, as well as methods for CRUD operations.

Recommendations

doing all crud operations
doing all crud operations with one class

What is the best PHP crud class?
How to create CRUD with PHP

database crud for each table
Package to analyze each table and create pdo crud for each

mysql database
script for update mysql database

How to find package ?
I'd like find package for accessing MySQL database.

php class file for InnoDB having the transaction handling
Mysql Innodb connection handling in PHP

PHPeclipse - PHP - Code Templates
Generate DB class, manager and exception file like PHPeclipse

MySQL table editor
Need to be able to create an interface to edit the table data

Good and simple MySQL wrapper
What MySQL wrapper should I go with?

Best PHP mysql to mysqli or PDO solution
How to convert mysql code to use mysqli?

Access data base
Pre-written PHP MySQL functions class

Map database records to objects
Store and retrieve objects without writing native SQL again

  Performance   Level  
Name: Saro Carvello <contact>
Classes: 2 packages by
Country: Italy Italy
Age: 51
All time rank: 206080 in Italy Italy
Week rank: 46 Up3 in Italy Italy Up

 

Details

MySQLReflection

A useful utility for the Object Relation Mapping of MySQL databases

The utility generates automatically PHP classes for any tables of a given database schema.

Package is extracted from my personal PHP Web MVC Framework.

To generate PHP classes with the purpose of mapping database tables you need to:

1) IMPORTANT! Use lowercase with the underscore, which is the widely used MySQL naming notation, on your database tables and fields names.

2) Configure your database schema by modifying util\mysqlreflection\mysqlreflection.config.php file and, assigning appropriate values to DBHOST, DBNAME, DBUSER, DBPASSWORD, and DBPORT PHP constants, according to your MySQL settings.

3) Then, launch the tool by typing: http/localhost/util/app_create_beans.php

Note that, the GUI of the utility uses Bootstrap and jQuery from CDN. So you also need an internet connection alive before running it.   

4) Once the utility is started, click "_Generate classes_" button.

After running the utility you will find all generated classes into "beans" folder.

Note:

  • Auto generated classes are prefixed with "Bean".
  • Each auto generated class uses bean\bean.config.php for configuration info.
  • Each auto generated class uses Model.php and MySqlRecord.php

An auto generated MySQL class provides the following services:

  • A constructor for managing a fetched table?s row or for a adding a new one
  • Management for both single or composite Primary Keys
  • Automatic mapping of the different date formats may occurs between application and database
  • Destructor to automatically close database connection
  • Defines a set of attributes corresponding to the table fields
  • Setter and Getter methods for each attribute
  • OO methods for simplify DML select, insert, update and delete operations
  • A facility for quickly updating a previously fetched row
  • Useful methods to obtain table DDL and the last executed SQL statement
  • Error handling of SQL statements
  • Camel/Pascal case naming convention for Attributes/Class used for mapping Fields/Table
  • Useful PHPDOC information about table, fields and the usage of class, attributes and methods.

Developers can quickly use these classes on their application.

Into the beans directory are located some auto generated classes of a MySQL schema.

DDL for MySQL schema is into a script file located into "sql" directory.

There is also a simple tester script "app_run_bean.php" for showing usage of a generated class.

Utility GUI

alt tag

Overview

alt tag

UML Class Model

alt tag

Convert MySQL into PHP Classes automatically - Video Tutorial (old user interface)

IMAGE ALT TEXT HERE

Thanks

Many and many thanks to https://www.jetbrains.com for granting me an open source license of magic

https://www.jetbrains.com/phpstorm/ PHPStorm


that I used in the development of MySQLReflection.

  Files folder image Files  
File Role Description
Files folder imagebeans (17 files)
Files folder imagedocs (6 files)
Files folder imagemysqlreflection (7 files)
Files folder imagesql (1 file)
Accessible without login Plain text file app_create_beans.php Example Example script
Accessible without login Plain text file app_run_bean.php Example Example script
Accessible without login Plain text file composer.json Data Auxiliary data
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file mysqlreflection.config.php Aux. Auxiliary script
Accessible without login Plain text file README.md Doc. Documentation

  Files folder image Files  /  beans  
File Role Description
  Accessible without login Plain text file bean.config.php Aux. Auxiliary script
  Plain text file BeanAclActions.php Class Class source
  Plain text file BeanDepartments.php Class Class source
  Plain text file BeanDeptEmp.php Class Class source
  Plain text file BeanDeptManager.php Class Class source
  Plain text file BeanEmployees.php Class Class source
  Plain text file BeanMultiplePk.php Class Class source
  Plain text file BeanSalaries.php Class Class source
  Plain text file BeanSinglePkDate.php Class Class source
  Plain text file BeanSinglePkDateTime.php Class Class source
  Plain text file BeanSinglePkInt.php Class Class source
  Plain text file BeanSinglePkIntAuto.php Class Class source
  Plain text file BeanSinglePkString.php Class Class source
  Plain text file BeanTitles.php Class Class source
  Plain text file BeanUser.php Class Class source
  Plain text file Model.php Class Class source
  Plain text file MySqlRecord.php Class Class source

  Files folder image Files  /  docs  
File Role Description
  Accessible without login Image file gui.png Data Auxiliary data
  Accessible without login HTML file index.html Doc. Documentation
  Accessible without login Image file MySQLReflection.png Data Auxiliary data
  Accessible without login Plain text file README.md Doc. Documentation
  Accessible without login Plain text file tutorial_text.txt Doc. Documentation
  Accessible without login Image file UMLClassModel.png Data Auxiliary data

  Files folder image Files  /  mysqlreflection  
File Role Description
  Plain text file MVCMySqlBeanBuilder.php Class Class source
  Plain text file MVCMySqlBeanClass.php.tpl Class Class source
  Plain text file MVCMySqlFieldToAttributeReflection.php Class Class source
  Plain text file MVCMySqlPKAnalyzer.php Class Class source
  Plain text file MVCMySqlSchemaReflection.php Class Class source
  Plain text file MVCMySqlSimpleTemplate.php Class Class source
  Plain text file MVCMySqlTableReflection.php Class Class source

  Files folder image Files  /  sql  
File Role Description
  Accessible without login Plain text file bean_db.sql Data Auxiliary data

 Version Control Unique User Downloads Download Rankings  
 92%
Total:582
This week:5
All time:5,198
This week:56Up
User Ratings User Comments (1)
 All time
Utility:91%StarStarStarStarStar
Consistency:91%StarStarStarStarStar
Documentation:91%StarStarStarStarStar
Examples:91%StarStarStarStarStar
Tests:-
Videos:75%StarStarStarStar
Overall:80%StarStarStarStarStar
Rank:16
 
Very useful to autogenerate PHP classes from MySQL.
2 years ago (Rossella Aiello)
87%StarStarStarStarStar