PHPackages                             beyondbluesky/doctrine-pdo-dblib - 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. beyondbluesky/doctrine-pdo-dblib

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

beyondbluesky/doctrine-pdo-dblib
================================

Library for support of the pdo\_dblib (MSSQL) driver in Doctrine

1.2(5y ago)0462MITPHPPHP &gt;=5.3.2

Since May 10Pushed 5y agoCompare

[ Source](https://github.com/beyondbluesky/LswDoctrinePdoDblib)[ Packagist](https://packagist.org/packages/beyondbluesky/doctrine-pdo-dblib)[ Docs](http://www.beyondbluesky.com)[ RSS](/packages/beyondbluesky-doctrine-pdo-dblib/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (6)Used By (0)

LswDoctrinePdoDblib
===================

[](#lswdoctrinepdodblib)

Doctrine 2 does support any method of connecting to SQL Server on a Linux box. Here's a simple driver that supports PDO DBlib. Many tests fail, but most are related to shortcomings of the PDODBlib driver. There is a patch in the PHP repo to add transaction and lastInsertId support, but this package has some minor work arounds.

This bundle requires the following:

- pdo\_dblib
- FreeTDS

FreeTDS configuration
---------------------

[](#freetds-configuration)

DBLib requires FreeTDS. We can't go into detail about configuring FreeTDS, but the connection configured should look something like following:

```
[mssql_freetds]
    host = 172.30.252.25
    port = 1433
    tds version = 8.0
    client charset = UTF-8
    text size = 20971520

```

Setting up bundle in Symfony
----------------------------

[](#setting-up-bundle-in-symfony)

In your Symfony2 project, modify your `config.yml` as follows to use the DBlib bundle and the server setup under FreeTDS:

```
# Doctrine Configuration
doctrine:
    dbal:
        driver_class:   Lsw\DoctrinePdoDblib\Doctrine\DBAL\Driver\PDODblib\Driver
        host:           mssql_freetds
```

And in your `autoload.php` register the new bundle:

```
$loader->registerNamespaces(array(
    'PDODblib'         => __DIR__ . '/../vendor/bundles',
));
```

Putting everything together
---------------------------

[](#putting-everything-together)

Getting everything together wasn't easy. You need to complete the following steps, checking each installation is successful by connecting with the appropriate tools:

- Install FreeTDS and configure a server connection
    - *Verify* with `./tsql -S mssql_freetds -U yourusername -P yourpassword`
- Install the PHP DBLib extension -- verify with PHP script containing
    - *Verify* `$pdo = new PDO('dblib:host=mssql_freetds;dbname=yourdb', 'yourusername', 'yourpassword');`
- Install and configure the PDODblibBundle
    - *Verify* Some kind of SQL against your database

FYI - PHP pdo\_dblib patch
--------------------------

[](#fyi---php-pdo_dblib-patch)

You can find a patch for some of the short-comings of pdo\_dblib on SVN.

[http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo\_dblib/dblib\_driver.c?view=log](http://svn.php.net/viewvc/php/php-src/trunk/ext/pdo_dblib/dblib_driver.c?view=log)

See: Revision 300647 - lastInsertId Revision 300628 - transaction support

FYI - Doctrine Test Suite
-------------------------

[](#fyi---doctrine-test-suite)

Doctrine2's test suite does not allow you to add database drivers on the fly. If you want to test this package, modify `Doctrine/DBAL/Driver/DriverManager::$_driverMap` as follows:

```
final class DriverManager
{
    private static $_driverMap = array(
		/* ... snip ... */
        'pdo_dblib' => 'Doctrine\DBAL\Driver\PDODblib\Driver',
    );
}
```

FYI - Generating Entities from database
---------------------------------------

[](#fyi---generating-entities-from-database)

It's possible, but not easy. Here's what I did:

- Map any non-compatible column types to string
- Hack the Doctrine core to skip any tables without primary keys

###  Health Score

29

—

LowBetter than 60% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity62

Established project with proven stability

 Bus Factor2

2 contributors hold 50%+ of commits

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

Every ~705 days

Total

5

Last Release

1929d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/8aced26e027318ee32d5370b644236de355b5ebd59574212fbcf62092cdd61b1?d=identicon)[darlock](/maintainers/darlock)

---

Top Contributors

[![raztud](https://avatars.githubusercontent.com/u/1500732?v=4)](https://github.com/raztud "raztud (8 commits)")[![trooney](https://avatars.githubusercontent.com/u/303015?v=4)](https://github.com/trooney "trooney (6 commits)")[![DerManoMann](https://avatars.githubusercontent.com/u/47783?v=4)](https://github.com/DerManoMann "DerManoMann (3 commits)")[![beyondbluesky](https://avatars.githubusercontent.com/u/64601551?v=4)](https://github.com/beyondbluesky "beyondbluesky (2 commits)")[![mabuzagu](https://avatars.githubusercontent.com/u/459106?v=4)](https://github.com/mabuzagu "mabuzagu (1 commits)")[![neilime](https://avatars.githubusercontent.com/u/314088?v=4)](https://github.com/neilime "neilime (1 commits)")[![nrocco](https://avatars.githubusercontent.com/u/694012?v=4)](https://github.com/nrocco "nrocco (1 commits)")[![GabrielAnca](https://avatars.githubusercontent.com/u/251391?v=4)](https://github.com/GabrielAnca "GabrielAnca (1 commits)")[![spoelwijk](https://avatars.githubusercontent.com/u/81775?v=4)](https://github.com/spoelwijk "spoelwijk (1 commits)")[![ex-f](https://avatars.githubusercontent.com/u/22606491?v=4)](https://github.com/ex-f "ex-f (1 commits)")

---

Tags

doctrinepdomssqldblibpdo\_dblib

### Embed Badge

![Health badge](/badges/beyondbluesky-doctrine-pdo-dblib/health.svg)

```
[![Health](https://phpackages.com/badges/beyondbluesky-doctrine-pdo-dblib/health.svg)](https://phpackages.com/packages/beyondbluesky-doctrine-pdo-dblib)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[fresh/doctrine-enum-bundle

Provides support of ENUM type for Doctrine2 in Symfony applications.

4636.8M12](/packages/fresh-doctrine-enum-bundle)[scienta/doctrine-json-functions

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

58523.9M36](/packages/scienta-doctrine-json-functions)[laravel-doctrine/orm

An integration library for Laravel and Doctrine ORM

8425.3M87](/packages/laravel-doctrine-orm)[nette/database

💾 Nette Database: layer with a familiar PDO-like API but much more powerful. Building queries, advanced joins, drivers for MySQL, PostgreSQL, SQLite, MS SQL Server and Oracle.

5656.7M234](/packages/nette-database)[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)

PHPackages © 2026

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