acseo/sql-server-bundle
Symfony bundle that adds SQL Server datatype conversions for Doctrine ORM/DBAL. Provides custom types for string, text and datetime, plus a driver class and a Composer post-install script to register the pdo_dblib driver for Doctrine DriverManager.
DATETIME2, NVARCHAR(MAX)) that PDO_DBLIB might mishandle. However, Laravel’s native Eloquent does not use Doctrine’s type system directly, requiring manual integration or a hybrid approach.pdo_dblib is installed and configured, which is non-standard in Laravel (typically uses pdo_sqlsrv). This introduces dependency conflicts unless the Laravel app explicitly supports both drivers.DatabaseManager or a custom connection resolver).post-install-cmd modifies Doctrine’s DriverManager directly, which is invasive and could clash with Laravel’s autoloader or other packages (e.g., doctrine/dbal).AppKernel, Bundle class) requires:
Illuminate\Container).BootstrapServiceProvider or a custom DatabaseServiceProvider.DATETIME2 ↔ Carbon conversions).Why PDO_DBLIB?
pdo_dblib a hard requirement, or can the bundle support pdo_sqlsrv with minimal changes?sqlsrv driver or packages like vlucas/phpdotenv for MSSQL?Laravel-Specific Gaps
Alternatives
Connection resolvers, DBAL event listeners) to achieve the same goal?Testing Strategy
UNIQUEIDENTIFIER, XML, GEOGRAPHY types.)Migration Path
DATETIME ↔ Carbon).NVARCHAR(MAX) truncated to VARCHAR(255)).pdo_sqlsrv (native Microsoft driver).Assessment Phase:
SELECT * returning incorrect PHP types).pdo_dblib is the preferred driver (or if pdo_sqlsrv can be used instead).Proof of Concept (PoC):
LaravelSQLServerBundle) that:
ServiceProvider.post-install-cmd to patch DriverManager (risky; consider a custom DBAL extension instead).Illuminate\Database\Connection to use the bundle’s driver.// app/Models/MssqlModel.php
protected $casts = [
'created_at' => 'datetime:Y-m-d H:i:s.u', // Force Carbon format
];
Implementation:
dev-master).AppServiceProvider to:
Types registry.Connection resolver to use SQLServerDriver.config/database.php to point to the custom driver.Fallback Plan:
laravel-mssql-type-converters).pdo_dblib and Doctrine DBAL 2.x).DATETIME2, JSON, etc.).pdo_dblib may require manual PHP extensions or Docker configurations.NULL instead of empty string).How can I help you explore Laravel packages today?