2017 © Pedro Peláez
 

library mysql-tso

Creates a PHP object which describes the MySQL table structure for a specified table in the database.

image

milantex/mysql-tso

Creates a PHP object which describes the MySQL table structure for a specified table in the database.

  • Saturday, April 29, 2017
  • by Milantex
  • Repository
  • 0 Watchers
  • 0 Stars
  • 7 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 1 Forks
  • 0 Open issues
  • 3 Versions
  • 0 % Grown

The README.md

Build Status codecov Code Climate Latest Stable Version Total Downloads License SensioLabsInsight, (*1)

What is MySQL-TSO?

This package provides a mechanism that analyzes the structure of tables in a MySQL/MariaDB database. It might be better to see an example of how to use it instead of reading a lengthy description., (*2)

Installation

Using composer in the command line

You can use composer to install the package using the following command from within your project's source directory:, (*3)

composer require milantex/mysql-tso, (*4)

Make sure to update your autoloader if needed:, (*5)

composer dump-autoload -o, (*6)

Requiring the package as a dependency in composer.json

Add the following code to your composer.json. Here is an example of a composer.json file with the milantex/mysql-tso package required:, (*7)

{
    "name": "your-name/your-project",
    "description": "Your project's description",
    "type": "project",
    "license": "MIT",
    "authors": [
        {
            "name": "Your Name",
            "email": "your@mail.tld"
        }
    ],
    "require": {
        "milantex/mysql-tso": "*"
    }
}

Make sure to run the composer command to install dependencies:, (*8)

composer install, (*9)

Using the library in your project

    require_once '../vendor/autoload.php';

    use Milantex\DAW\DataBase;
    use Milantex\TSO\TableStructureDescriptor;

    # Enter database parameters
    $daw = new DataBase('localhost', 'demo', 'root', '');

    # Instantiate a table structure descriptor object
    $tso = new TableStructureDescriptor($daw);

    # Start the database analysis
    $tso->analyse();

    if ($tso->tableExists('page') &&
        $tso->getTableStructure('page')->fieldExists('title')) {
        echo 'Can page.title be null? ';
        if ($tso->getTableStructure('page')
                ->getFieldStructure('title')
                ->isNullable()) {
            echo 'Yes';
        } else {
            echo 'No';
        }
    }

The Versions

29/04 2017

dev-master

9999999-dev

Creates a PHP object which describes the MySQL table structure for a specified table in the database.

  Sources   Download

MIT

The Requires

 

The Development Requires

29/04 2017

1.0.1

1.0.1.0

Creates a PHP object which describes the MySQL table structure for a specified table in the database.

  Sources   Download

MIT

The Requires

 

The Development Requires

26/04 2017

1.0.0

1.0.0.0

Creates a PHP object which describes the MySQL table structure for a specified table in the database.

  Sources   Download

MIT

The Requires