Returns an array of column information from a database table.

v1.7.0 2018-01-09 16:17 UTC


Latest Version on Packagist Software License Build Status Coverage Status Quality Score Total Downloads

Describe is a PHP library that returns Column objects based on table schema information from a database.


Install Describe through Composer:

$ composer require rougin/describe

Basic Usage

Using a vendor-specific driver

use Rougin\Describe\Driver\MySQLDriver;

$dsn = 'mysql:host=localhost;dbname=demo';

$pdo = new PDO($dsn, 'root', '');

$driver = new MySQLDriver($pdo, 'demo');

Available drivers:

Using a DatabaseDriver

use Rougin\Describe\Driver\DatabaseDriver;

$credentials = array('password' => '');

$credentials['hostname'] = 'localhost';
$credentials['database'] = 'demo';
$credentials['username'] = 'root';

$driver = new DatabaseDriver('mysql', $credentials);

Using Table

$table = new Rougin\Describe\Table('users', $driver);

// Returns an array of "Column" instances

// Returns the primary key "Column" from the table

For more information regarding the Column object, kindly check it here.

Adding a new database driver

To add a driver for a specified database, just implement it to a DriverInterface:

namespace Rougin\Describe\Driver;

 * Database Driver Interface
 * An interface for handling PDO drivers.
 * @package Describe
 * @author  Rougin Royce Gutib <>
interface DriverInterface
     * Returns an array of Column instances from a table.
     * @param  string $table
     * @return \Rougin\Describe\Column[]
    public function columns($table);

     * Returns an array of Table instances.
     * @return \Rougin\Describe\Table[]
    public function tables();

Projects using Describe


Combustor uses Describe for getting database information for generating a codebase.


Same as Combustor, Refinery also uses Describe for creating database migrations for Codeigniter.

Change log

Please see CHANGELOG for more information what has changed recently.


$ composer test


If you discover any security related issues, please email instead of using the issue tracker.



The MIT License (MIT). Please see License File for more information.