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

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

soitpl/doctrine-pdo-dblib
=========================

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

1.1.0(9y ago)019MITPHPPHP &gt;=5.3.2

Since May 10Pushed 4y agoCompare

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

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

Deprecated
----------

[](#deprecated)

This repository is no longer being actively maintained. We encourage you to not use this code. If you rely on this code you might want to fork the repository to keep your systems from breaking, if we remove this repository in the future.

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

27

—

LowBetter than 49% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity6

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity61

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 ~395 days

Total

4

Last Release

3558d ago

### Community

Maintainers

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

---

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)")[![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/soitpl-doctrine-pdo-dblib/health.svg)

```
[![Health](https://phpackages.com/badges/soitpl-doctrine-pdo-dblib/health.svg)](https://phpackages.com/packages/soitpl-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.9M35](/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.7M231](/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)
