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

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

josiah/doctrine-schema-builder
==============================

Provides a declarative interface for building a Doctrine DBAL Schema.

1.0.0(12y ago)11.3k1MITPHP

Since Jul 7Pushed 12y ago1 watchersCompare

[ Source](https://github.com/Josiah/DoctrineSchemaBuilder)[ Packagist](https://packagist.org/packages/josiah/doctrine-schema-builder)[ RSS](/packages/josiah-doctrine-schema-builder/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Doctrine Schema Builder
=======================

[](#doctrine-schema-builder)

[![Build Status](https://camo.githubusercontent.com/e0f9a812e45ae380eb08d69cd15ca0c69d431b9b685d8fffd95243cd49a946e6/68747470733a2f2f7472617669732d63692e6f72672f4a6f736961682f446f637472696e65536368656d614275696c6465722e706e67)](https://travis-ci.org/Josiah/DoctrineSchemaBuilder)

Provides a declarative wrapper around the Doctrine DBAL `Schema` class which allows you to define the schema as you would like it to be rather than in terms of what it was.

Example
-------

[](#example)

Actions speak louder than words so here's an example of the builder in action:

```
use Doctrine\DBAL\Schema\Builder;
use Doctrine\DBAL\Schema\Schema;
use Doctrine\DBAL\Schema\Table;

$schema = new Schema();
$builder = new Builder($schema);

$builder
    // Create table if it doesn't exist, do nothing if it does
    ->createTable('foo', function (Table $table) {
        $table->addColumn('id', 'integer')
            ->setNotNull(true)
            ->setUnsigned(true)
            ->setAutoIncrement(true)
            ->setComment("Unique Identifier, DUH!");

        $table->addColumn('name', 'string')
            ->setNotNull(true);

        $table->setPrimaryKey(['id']);

        // ... you get the picture.
    })

    // Overwrite table if it exists, create it if it doesnt
    ->defineTable('bar', function (Table $table) {
        // ... more definition like before
    })

    // Drop table if it exists, do nothing if it doesnt
    ->dropTable('baz');
```

License
-------

[](#license)

Licenced under an [MIT license](LICENSE). If that doesn't work for you get in touch with me.

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 100% 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.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

4690d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/6cbc6e30c0a2b76d5f4942120f4874bb63b728f285e58da37ae1c9466a950c61?d=identicon)[josiah](/maintainers/josiah)

---

Top Contributors

[![Josiah](https://avatars.githubusercontent.com/u/77621?v=4)](https://github.com/Josiah "Josiah (9 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[scienta/doctrine-json-functions

A set of extensions to Doctrine that add support for json query functions.

58523.9M35](/packages/scienta-doctrine-json-functions)[martin-georgiev/postgresql-for-doctrine

Extends Doctrine with native PostgreSQL support for arrays, JSONB, ranges, PostGIS geometries, text search, ltree, uuid, and 100+ PostgreSQL-specific functions.

4485.3M4](/packages/martin-georgiev-postgresql-for-doctrine)[damienharper/auditor-bundle

Integrate auditor library in your Symfony projects.

4542.8M](/packages/damienharper-auditor-bundle)[sonata-project/entity-audit-bundle

Audit for Doctrine Entities

644989.8k1](/packages/sonata-project-entity-audit-bundle)[overtrue/laravel-versionable

Make Laravel model versionable.

585308.0k5](/packages/overtrue-laravel-versionable)[worksome/foggy

Foggy is a tool for making database dumps with some data removed/changed.

26571.7k1](/packages/worksome-foggy)

PHPackages © 2026

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