PHP Classes
elePHPant
Icontem

PHP CSV to Data Dictionary: Generate data dictionary from CSV file

Recommend this page to a friend!
  Info   View files Example   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2015-05-15 (2 years ago) RSS 2.0 feedNot enough user ratingsTotal: 302 All time: 7,115 This week: 567Up
Version License PHP version Categories
csv-dictionary 1.0GNU General Publi...5PHP 5, Databases, Files and Folders
Description Author

This class can generate data dictionary from CSV file.

It parses the CSV file and attempts to detect the types of data on each column. It can detect text strings, integers, floats and booleans.

The class can optionally extract the field names from the header row.

It can also generate a SQL query to create a table with the structure of fields of the detected types, as well SQL insert statements to to insert the parsed data into the table rows.

The class can also output the data dictionary in a human readable format on a Web page.

Innovation Award
PHP Programming Innovation award winner
July 2015
Winner


Prize: One subscription to the PDF edition of the PHP Architect magazine
Many applications can import data exported by other programs in the CSV format.

When you want to import CSV data into a database, you need to create the necessary tables to insert the records of CSV data.

This class can help performing that task by examining a CSV file to determine the names and types of the fields of the records of the table to be created.

Manuel Lemos
  Performance   Level  
Name: Dave Smith is available for providing paid consulting. Contact Dave Smith .
Classes: 37 packages by
Country: United States United States
Age: 52
All time rank: 13214 in United States United States
Week rank: 3 Up1 in United States United States Up
Innovation award
Innovation award
Nominee: 26x

Winner: 6x

Details
Class: csvdict
Version: 1.0 5/15/2015

Copyright 2015 Wagon Trader

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program.  If not, see <http://www.gnu.org/licenses/>.


Description:

This class generates a data dictionary from data supplied in a csv file.

It can display a human readable data dictionary.

It can return the SQL query statement to create the database table.

It can return the SQL query statements to insert the data into the table.


Files:

csvdict.class.php - Main class

example.php - Example usage script

sample.csv - Sample csv file


Installation:

Upload files to a web accessible location on your server (eg. public_html)


Configuration:

The class is configured to work with most server configurations.


Usage:

The included example.php file includes examples on instantiating the class and basic operation instructions.

Complete method usage is documented in the class.
  Files folder image Files  
File Role Description
Plain text file csvdict.class.php Class Main Class
Accessible without login Plain text file example.php Example Example Usage
Accessible without login Plain text file license.txt Lic. License
Accessible without login Plain text file manual.txt Doc. Documentation
Accessible without login Plain text file sample.csv Data Sample data

 Version Control Unique User Downloads Download Rankings  
 0%
Total:302
This week:0
All time:7,115
This week:567Up