2017 © Pedro Peláez
 

library laravel-sqlserver

Use ODBC to connect with your SQL Server instances from Laravel 5+

image

techscope/laravel-sqlserver

Use ODBC to connect with your SQL Server instances from Laravel 5+

  • Saturday, June 24, 2017
  • by techscope
  • Repository
  • 3 Watchers
  • 8 Stars
  • 230 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 2 Forks
  • 4 Open issues
  • 1 Versions
  • 48 % Grown

The README.md

laravel-sqlserver

Use ODBC to connect with your SQL Server instances from Laravel 5+., (*1)

This package allows you to use the OFFICIAL Microsoft SQL Server ODBC driver to connect to a Microsoft SQL Server database., (*2)

Disclaimer: all Bash commands you will see here are examples for RHEL/CentOS Yum package manager. If you would like to help make these docs more friendly with other distros, please make sure to either submit a pull request on the README or open an issue with additional commands specifying which distro you are using and I'll then update the README docs., (*3)

Dependencies

UnixODBC

sudo yum install -y unixodbc

PHP's ODBC PDO driver

sudo yum install -y php-odbc

Microsoft's SQL Server Driver

You can find specific instructions for your distro here: https://docs.microsoft.com/en-us/sql/connect/odbc/linux-mac/installing-the-microsoft-odbc-driver-for-sql-server, (*4)

Package Installation

Install with composer, (*5)

composer require techscope/laravel-sqlserver:dev-master

Add the Service Provider to config/app.php, (*6)

TechScope\SqlServer\SqlServerServiceProvider::class

Make sure to update your config/database.php file, (*7)

'domdb' => [
            'driver'        => 'sqlsrv',
            'odbc_driver'   => '{ODBC Driver 13 for SQL Server}',
            'host'          => env('DB_HOST', 'localhost'),
            'database'      => env('DB_DATABASE', 'forge'),
            'username'      => env('DB_USERNAME', 'forge'),
            'password'      => env('DB_PASSWORD', ''),
            'port'          => env('DB_PORT', '1433'),
            'TrustServerCertificate' => 'yes'
        ],

IMPORTANT NOTES: - driver should be set to sqlsrv. This uses the preexisting SQL Server grammar that ships with Laravel. - odbc_driver should be the name of the ODBC Driver as it appears in /etc/odbcinst.ini. Example:, (*8)

[ODBC Driver 13 for SQL Server] <--- USE THIS LINE OR SIMILAR DEPENDENDING ON WHICH VERSION YOU INSTALL
Description=Microsoft ODBC Driver 13 for SQL Server
Driver=/opt/microsoft/msodbcsql/lib64/libmsodbcsql-13.1.so.8.0
UsageCount=1
  • For the ODBC Driver MAKE SURE TO REPLACE THE SQUARE BRACKETS ([]) WITH CURLY BRACES ({}) IN config/database.php
  • You must use the host, database, username, password, port properties to properly setup the DSN string for the ODBC Connection
  • any additional parameters you'd like to use for the connection can be found here: https://docs.microsoft.com/en-us/sql/relational-databases/native-client/applications/using-connection-string-keywords-with-sql-server-native-client
    • NOTE: the Address, Addr, Database, Server, UID, PWD, Network, Net, DSN and Database properties cannot be used here and will be ignored as they are already specified the Laravel way

The Versions

24/06 2017

dev-master

9999999-dev https://github.com/techscope/finicity

Use ODBC to connect with your SQL Server instances from Laravel 5+

  Sources   Download

MIT

The Requires

 

The Development Requires

database laravel mssql microsoft sql server sqlsrv techscope sqlexpress