PHPackages                             rotexsoft/sqlschema - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Database &amp; ORM](/categories/database)
4. /
5. rotexsoft/sqlschema

ActiveLibrary[Database &amp; ORM](/categories/database)

rotexsoft/sqlschema
===================

Provides facilities to read table names and table columns from a database using PDO. This package is a fork of https://packagist.org/packages/aura/sqlschema ( https://github.com/auraphp/Aura.SqlSchema ). It adds PHP 8.1+ suport and is also designed to work with Mariadb 10.4+ and above.

4.0.0(5mo ago)01.3k↓68.8%2BSD-2-ClausePHPPHP &gt;=8.2.0CI passing

Since Jan 10Pushed 5mo agoCompare

[ Source](https://github.com/rotexsoft/Aura.SqlSchema)[ Packagist](https://packagist.org/packages/rotexsoft/sqlschema)[ Docs](https://github.com/rotexdegba/Aura.SqlSchema)[ RSS](/packages/rotexsoft-sqlschema/feed)WikiDiscussions rotexsoft-4.x Synced 3w ago

READMEChangelog (6)Dependencies (4)Versions (15)Used By (2)

Rotexsoft/SqlSchema a fork of Aura.SqlSchema
============================================

[](#rotexsoftsqlschema-a-fork-of-aurasqlschema)

Provides facilities to read table names and table columns from a database using a [PDO](http://php.net/PDO) connection.

Foreword
--------

[](#foreword)

This fork has been fine-tuned to work with Mariadb which [Aura.SqlSchema](https://github.com/auraphp/Aura.SqlSchema) was not designed to support. This fork has been tested against the following databases:

- Mariadb 10.4.x, 10.5.x, 10.6.x, 10.11.x, 11.4.x, 11.8.x &amp; 12.1.x
- Mysql 5.6, 5.7, 8.0.x &amp; 8.4.x
- Postgres 12.x, 13.x, 14.x, 15.x, 16.x, 17.x &amp; 18.x

Some future work will be done to make sure it works with Microsoft Sql Server

### Installation

[](#installation)

This library requires PHP 8.2 or later; we recommend using the latest available version of PHP as a matter of principle. It has no userland dependencies.

It is installable and autoloadable via Composer as [rotexsoft/sqlschema](https://packagist.org/packages/rotexsoft/sqlschema).

Alternatively, [download a release](https://github.com/rotexdegba/Aura.SqlSchema/releases) or clone this repository, then require or include its *autoload.php* file.

### Quality

[](#quality)

[![Coverage Status](https://camo.githubusercontent.com/831cb05121b74b975fd0eb5e9ab324c4e8f6dd49d611765d63680fe4563bf48c/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f726f74657864656762612f417572612e53716c536368656d612f62616467652e7376673f6272616e63683d726f746578736f66742d342e78)](https://coveralls.io/github/rotexdegba/Aura.SqlSchema?branch=rotexsoft-4.x)[![Run PHP Tests and Code Quality Tools](https://github.com/rotexdegba/Aura.SqlSchema/actions/workflows/php.yml/badge.svg)](https://github.com/rotexdegba/Aura.SqlSchema/actions/workflows/php.yml)

To run the unit tests at the command line, issue `phpunit` at the package root. (This requires [PHPUnit](http://phpunit.de/manual/) to be available as `phpunit`.)

This library attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

### Branching

[](#branching)

These are the branches in this repository:

- **2.x:** Corresponds to the **2.x** branch in the original [Aura.SqlSchema Repository](https://github.com/auraphp/Aura.SqlSchema). There's no plan to actively maintain this branch, but it could be synced with the [Aura.SqlSchema Repository](https://github.com/auraphp/Aura.SqlSchema) (i.e. changes to the **2.x** branch in that repo can be pulled in).
- **php-8-deprecation-fixes:** this branch was started from the **2.x** branch and contains changes to make the code-base compliant with PHP 8.1+ &amp; increased the minimum PHP version to 8.1. It was meant as a branch to be contributed to the [Aura.SqlSchema Repository](https://github.com/auraphp/Aura.SqlSchema). See [auraphp#22](https://github.com/auraphp/Aura.SqlSchema/issues/22)
- **rotexsoft-3.x:** this branch was started from the **php-8-deprecation-fixes** branch. It is no longer compatible with the original [Aura.SqlSchema package](https://github.com/auraphp/Aura.SqlSchema) due to the following changes:

    - changed the **Aura\\SqlSchema** namespace to **Rotexsoft\\SqlSchema**
    - more stricter type-hinting applied across the code-base, leading to changes in some of the interface method signatures.

    > This is going to be the branch in which code for version 3.x releases of **rotexsoft/sqlschema** will reside
- **rotexsoft-4.x:** contains version 4.x code

There will be future branches like **rotexsoft-n.x** &amp; the likes for versions n.x &amp; above (where n represents the next major version).

### Testing

[](#testing)

There should be a **./phpunit.xml** file if you have run the **composer update** or **composer install** command at least once.

Edit the **./phpunit.xml** to contain the correct database connection info for MySql &amp; Postgres or comment out the MySql &amp; Postgres variables to only test against Sqlite and the run the command below to test:

```
./vendor/bin/phpunit

```

If you are running on a Linux OS with podman installed, you can run the **./run-tests-against-multiple-db-versions.php** script to do a more extensive test against multiple versions of MariaDB, MySql &amp; Postgres.

Getting Started
---------------

[](#getting-started)

### Instantiation

[](#instantiation)

Instantiate a driver-specific schema object with a matching [PDO](http://php.net/PDO) instance:

```

```

### Fetching Table Lists

[](#fetching-table-lists)

To get a list of tables in the database, issue `fetchTableList()`:

```

```

### Fetching Column Information

[](#fetching-column-information)

To get information about the columns in a table, issue `fetchTableCols()`:

```
