PHPackages                             soluble/metadata - 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. soluble/metadata

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

soluble/metadata
================

Extract metadata from database queries

1.3.2(7y ago)59621MITPHPPHP ^7.1CI failing

Since Jan 12Pushed 6y ago1 watchersCompare

[ Source](https://github.com/belgattitude/soluble-metadata)[ Packagist](https://packagist.org/packages/soluble/metadata)[ Docs](https://github.com/belgattitude/soluble-metadata)[ RSS](/packages/soluble-metadata/feed)WikiDiscussions master Synced 2mo ago

READMEChangelog (5)Dependencies (7)Versions (20)Used By (1)

[![PHP Version](https://camo.githubusercontent.com/c41e39196d4b40bb442a413f55cbc4c0b1b7d998de3e44f0fc282d696c1a9b79/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d372e312b2d6666363962342e737667)](https://packagist.org/packages/soluble/metadata)[![PHP Version](https://camo.githubusercontent.com/fc7971007087f4149e530d0b858341f06552ae4ee39d71f39e78f7372c9a7bf4/687474703a2f2f696d672e736869656c64732e696f2f62616467652f7068702d352e342b2d6666363962342e737667)](https://packagist.org/packages/soluble/metadata)[![Build Status](https://camo.githubusercontent.com/fdbe11dadc873871eaa1a8d175a3a3ceb394992121a0cee8454a927a0c9ecb2c/68747470733a2f2f7472617669732d63692e6f72672f62656c6761747469747564652f736f6c75626c652d6d657461646174612e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/belgattitude/soluble-metadata)[![codecov](https://camo.githubusercontent.com/71b6bc28f1cca018fa60dea3791f241d532e40e1a8bd4bfb2456d2a817a4313e/68747470733a2f2f636f6465636f762e696f2f67682f62656c6761747469747564652f736f6c75626c652d6d657461646174612f6272616e63682f6d61737465722f67726170682f62616467652e737667)](https://codecov.io/gh/belgattitude/soluble-metadata)[![Scrutinizer Quality Score](https://camo.githubusercontent.com/1b485363f066759dc2a253b7de9b21237788b24b7fcd8f5c761244a23aa73061/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f62656c6761747469747564652f736f6c75626c652d6d657461646174612f6261646765732f7175616c6974792d73636f72652e706e673f733d36663361623931663931366266363432663234386538326332393835376639346362353062623333)](https://scrutinizer-ci.com/g/belgattitude/soluble-metadata)[![Latest Stable Version](https://camo.githubusercontent.com/689ba6f1868d9efe9fbac5a5ee8de90da3adc02ac6a59f580812bf75993e9655/68747470733a2f2f706f7365722e707567782e6f72672f736f6c75626c652f6d657461646174612f762f737461626c652e737667)](https://packagist.org/packages/soluble/metadata)[![Total Downloads](https://camo.githubusercontent.com/1d2634e4263970058d7d7a6ecd7a30c31eaccc058f68698930609511463a7d64/68747470733a2f2f706f7365722e707567782e6f72672f736f6c75626c652f6d657461646174612f646f776e6c6f6164732e706e67)](https://packagist.org/packages/soluble/metadata)[![License](https://camo.githubusercontent.com/c6de4a5a86117572a02306322cba20810cedd29f1232fcfc51edabb815656ec7/68747470733a2f2f706f7365722e707567782e6f72672f736f6c75626c652f6d657461646174612f6c6963656e73652e706e67)](https://packagist.org/packages/soluble/metadata)

`soluble-metadata` is a *low level* library *currently focusing on MySQL* which extracts metadata from an sql query with extensibility, speed and portability in mind.

Use cases
---------

[](#use-cases)

You can take advantage of soluble/metadata to format/render resulting query data according to their type (when rendering an html table, generating an excel sheet...), for basic validation (max lengths, decimals)...

Features
--------

[](#features)

- Extract metadata information from an SQL query (datatypes,...)
- Common API across various driver implementations.
- Rely on native database driver information (does not parse the query in PHP)
- Works even when the query does not return results (empty resultset).
- Carefully tested with different implementations (libmariadb, mysqlnd, libmysql, pdo\_mysql).

> Under the hood, the metadata extraction relies on the driver methods `mysqli_stmt::result_metadata()` and `PDO::getColumnMeta()`. Although the `soluble-metadata` API unify their usage and type detection, differences still exists for more advanced features. A specific effort has been made in the documentation to distinguish possible portability issues when switching from one driver to another. Keep that in mind when using it.

Requirements
------------

[](#requirements)

- PHP engine 7.1+ (v1.2.0), 7.0+ and 5.4 (v1.0.0)
- Mysqli or PDO\_mysql extension enabled *(Mysqli exposes more features)*

Documentation
-------------

[](#documentation)

- This README and [API documentation](http://docs.soluble.io/soluble-metadata/api/) available.

Installation
------------

[](#installation)

Instant installation via [composer](http://getcomposer.org/).

```
$ composer require soluble/metadata
```

Most modern frameworks will include composer out of the box, but ensure the following file is included:

```
