PHP Classes

File: README.md

Recommend this page to a friend!
  Classes of Natanael Simões   PHP Database to File Download   README.md   Download  
File: README.md
Role: Documentation
Content type: text/markdown
Description: Auxiliary data
Class: PHP Database to File Download
Output database tables to JSON or XML using PDO
Author: By
Last change:
Date: 8 years ago
Size: 1,237 bytes
 

Contents

Class file image Download

DB2FILE

Retrieve data from database and generate/print JSON or XML file.

Installation

This library can be found on Packagist. We endorse that everything will work fine if you install this through composer.

Add in your composer.json:

{
    "require": {
        "natanaelsimoes/db2file": "1.0.0-beta"
    }
}

or in your bash:

$ composer require natanaelsimoes/db2file

Features

  • PSR-4 compliant for easy interoperability
  • Uses PDO to cover majority databases (Firebird, MySQL, Oracle, PostgreSQL, SQLite, Microsoft SQL Server)
  • Easy to add support for others PDO database drivers as needed
  • Gets and prints JSON/XML version of your tables and queries

See documentation docs/ for futher details about this library.

Usage

<?php
require 'vendor/autoload.php'
// Database configuration
$driver = DB2FILE\Converter::MySQL;
$dbname = 'information_schema';
$host = 'localhost';
$username = 'root';
$password = '123';
// Create converter
$converter = new DB2FILE\Converter($driver, $dbname, $host, $username, $password);
// Print the XML file in text/xml format
$converter->printXMLFromTable('ENGINES');
?>