PHPackages                             robclancy/schema-builder - 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. robclancy/schema-builder

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

robclancy/schema-builder
========================

Fork of illuminate/database to use the schema builder alone.

21442PHP

Since Apr 13Pushed 13y ago2 watchersCompare

[ Source](https://github.com/robclancy/schema-builder)[ Packagist](https://packagist.org/packages/robclancy/schema-builder)[ RSS](/packages/robclancy-schema-builder/feed)WikiDiscussions master Synced 2mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

Schema Builder
==============

[](#schema-builder)

This is a port of [http://github.com/illuminate/database](illuminate/database) to provide the schema builder without all the extra features.

[![Build Status](https://camo.githubusercontent.com/a728161d2d5f44dd797ca7f4c0fe4b939eb8aea0137eee9ed2a138cd5fa4c73d/68747470733a2f2f7365637572652e7472617669732d63692e6f72672f726f62636c616e63792f64622d636f6e6e6563746f722e706e67)](http://travis-ci.org/robclancy/db-connector)

The idea behind this is allowing the scheme builder to be used in projects that already have a database layer that uses `PDO`.

All you need to use this is a `PDO` instance. If you create it manually you might want to consider using [http://github.com/robclancy/db-connector](robclancy/db-connector) which is another fork of [http://github.com/illuminate/database](illuminate/database) but to just connect to the database. With your PDO instance you create a `Robbo\SchemaBuilder\Connection` instance and then call `->getSchemaBuilder()` to get started. Then you use the builder as described in the \[[http://four.laravel.com/docs/schema\](Laravel](http://four.laravel.com/docs/schema](Laravel) docs) however substitute your instance for `Schema::`.

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

[](#installation)

Add the following to the "require" section of your `composer.json` file:

```
	"robclancy/schema-builder": "1.0.x"
```

Native example
--------------

[](#native-example)

Following example will assume you have a `PDO` instance stored in `$pdo`.

```
// Create the connection
$connection = new Robbo\SchemaBuilder\Connection\MySqlConnection($pdo, 'database_name', 'tableprefix_');

// Alternatively you can use a factory method to create an instance depending on the driver
// Drivers supported: mysql, pgsql, sqlite and sqlsrv
$connection = Robbo\SchemaBuilder\Connection::create('mysql', $pdo, 'database_name', 'tableprefix_')

$builder = $connection->getSchemaBuilder();

// Now you can use it like in the laravel docs...
$builder->create('users', function($table)
{
    $table->increments('id');
});
```

Support for a dry run is also supported using the functionality from illuminate/database. Use it like so...

```
// $builder and $connection is the same from above

$queries = $connection->pretend(function($connection) use ($builder)
{
	// Could use $connection->getSchemaBuilder() here in place of $builder
	$builder->create('users', function($table)
	{
	    $table->increments('id');
	});
});

// Now $queries will contain all queries that were created
```

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community21

Small or concentrated contributor base

Maturity41

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 78.4% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ac33556a611a70332996beca9c9eb795f85368b32dd49bec5c49bf5181c37e93?d=identicon)[Robbo](/maintainers/Robbo)

---

Top Contributors

[![taylorotwell](https://avatars.githubusercontent.com/u/463230?v=4)](https://github.com/taylorotwell "taylorotwell (160 commits)")[![robclancy-test](https://avatars.githubusercontent.com/u/123053691?v=4)](https://github.com/robclancy-test "robclancy-test (8 commits)")[![bencorlett](https://avatars.githubusercontent.com/u/181919?v=4)](https://github.com/bencorlett "bencorlett (6 commits)")[![navruzm](https://avatars.githubusercontent.com/u/168341?v=4)](https://github.com/navruzm "navruzm (5 commits)")[![joecwallace](https://avatars.githubusercontent.com/u/925701?v=4)](https://github.com/joecwallace "joecwallace (4 commits)")[![tgriesser](https://avatars.githubusercontent.com/u/154748?v=4)](https://github.com/tgriesser "tgriesser (2 commits)")[![conradkleinespel](https://avatars.githubusercontent.com/u/1234006?v=4)](https://github.com/conradkleinespel "conradkleinespel (2 commits)")[![nckg](https://avatars.githubusercontent.com/u/360602?v=4)](https://github.com/nckg "nckg (2 commits)")[![barryvdh](https://avatars.githubusercontent.com/u/973269?v=4)](https://github.com/barryvdh "barryvdh (2 commits)")[![driesvints](https://avatars.githubusercontent.com/u/594614?v=4)](https://github.com/driesvints "driesvints (2 commits)")[![rmobis](https://avatars.githubusercontent.com/u/2119933?v=4)](https://github.com/rmobis "rmobis (1 commits)")[![kapv89](https://avatars.githubusercontent.com/u/1023032?v=4)](https://github.com/kapv89 "kapv89 (1 commits)")[![danielboendergaard](https://avatars.githubusercontent.com/u/314877?v=4)](https://github.com/danielboendergaard "danielboendergaard (1 commits)")[![HellPat](https://avatars.githubusercontent.com/u/1016798?v=4)](https://github.com/HellPat "HellPat (1 commits)")[![JonoB](https://avatars.githubusercontent.com/u/627725?v=4)](https://github.com/JonoB "JonoB (1 commits)")[![JoostK](https://avatars.githubusercontent.com/u/123679?v=4)](https://github.com/JoostK "JoostK (1 commits)")[![ackerdev](https://avatars.githubusercontent.com/u/2708892?v=4)](https://github.com/ackerdev "ackerdev (1 commits)")[![karptonite](https://avatars.githubusercontent.com/u/132278?v=4)](https://github.com/karptonite "karptonite (1 commits)")[![luisdalmolin](https://avatars.githubusercontent.com/u/403446?v=4)](https://github.com/luisdalmolin "luisdalmolin (1 commits)")[![msvrtan](https://avatars.githubusercontent.com/u/1780572?v=4)](https://github.com/msvrtan "msvrtan (1 commits)")

### Embed Badge

![Health badge](/badges/robclancy-schema-builder/health.svg)

```
[![Health](https://phpackages.com/badges/robclancy-schema-builder/health.svg)](https://phpackages.com/packages/robclancy-schema-builder)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
