PHPackages                             kkszymanowski/laravel-6-odbc - 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. kkszymanowski/laravel-6-odbc

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

kkszymanowski/laravel-6-odbc
============================

ODBC Connector for Laravel 6

6.0.6(3y ago)915.3k↓38.5%2[1 issues](https://github.com/KKSzymanowski/laravel-6-odbc/issues)MITPHPPHP ^7.2|^8.0

Since Sep 28Pushed 3y ago2 watchersCompare

[ Source](https://github.com/KKSzymanowski/laravel-6-odbc)[ Packagist](https://packagist.org/packages/kkszymanowski/laravel-6-odbc)[ RSS](/packages/kkszymanowski-laravel-6-odbc/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)Dependencies (3)Versions (7)Used By (0)

ODBC driver for Laravel 6, 7 and 8
----------------------------------

[](#odbc-driver-for-laravel-6-7-and-8)

Package inspired by [tck/odbc](https://github.com/bencarter78/odbc) but simplified, modernized and made compatible with Laravel 6, 7 and 8.

### Installation

[](#installation)

```
composer require kkszymanowski/laravel-6-odbc

```

Add you database configuration in `config/database.php`, for example:

```
'connections' => [
    'myOdbcConnection' => [
        'driver'   => 'odbc',
        'dsn'      => env('DB_ODBC_CONNECTION_STRING'),
        'host'     => env('DB_ODBC_HOST'),
        'database' => env('DB_ODBC_DATABASE'),
        'username' => env('DB_ODBC_USERNAME'),
        'password' => env('DB_ODBC_PASSWORD'),
    ],

    // ...
],
```

Add the environment variables referenced in the configuration to your `.env` file, for example:

```
DB_ODBC_CONNECTION_STRING="odbc:DRIVER=Pervasive;ServerName=192.168.0.1;DBQ=DATABASE;UID=User;PWD=Password"
DB_ODBC_HOST=192.168.0.1
DB_ODBC_DATABASE=DATABASE
DB_ODBC_USERNAME=User
DB_ODBC_PASSWORD=Password

```

If you would like to customize the schema grammar, query grammar, or the post processor used in the ODBC connection you can do that by extending `\Odbc\OdbcSchemaGrammar`, `\Odbc\OdbcQueryGrammar` and `\Odbc\OdbcProcessor` respectively. Then add the following configuration entries:

```
'database.connections.odbc.grammar.query'
'database.connections.odbc.grammar.schema'
'database.connections.odbc.processor'

```

For example in `config/database.php` add:

```
'connections' => [
    // ...

    'odbc' => [
        'grammar' => [
            'query' => \App\Grammars\CustomQueryGrammar::class,
            'schema' => \App\Grammars\CustomSchemaGrammar::class,
        ],
        'processor' => \App\Processors\CustomProcessor::class,
    ],

    // ...
],
```

One of the more common cases would be to customize the `compileLimit()` method used in pagination and in the `skip()` method. You can do this in the following way:

```
use Illuminate\Database\Query\Builder;
use Odbc\OdbcQueryGrammar;

class CustomQueryGrammar extends OdbcQueryGrammar
{
    /**
     * Compile the "limit" portions of the query.
     *
     * @param Builder $query
     * @param int     $limit
     *
     * @return string
     */
    protected function compileLimit(Builder $query, $limit)
    {
        return 'select top ' . (int) $limit;
    }
}
```

Note that the custom processor is **not** used when running raw queries, for example `$connection->select('SELECT * FROM USERS')`. To use it you must build the queries with the Eloquent query builder, for example:

```
User::get();
DB::connection('myOdbcConnection')->table('USERS')->get();
```

### Usage

[](#usage)

#### With Eloquent

[](#with-eloquent)

To override your default database connection define `$connection` name in your Eloquent Model

```
/**
 * The connection name for the model.
 *
 * @var string
 */
protected $connection = 'myOdbcConnection';
```

After defining the connection name you perform all the standard Eloquent operations:

```
$user = User::where('id', 1)->get();
$users = User::all();
```

#### Without Eloquent

[](#without-eloquent)

You can also perform queries without Eloquent models. Make sure you specify the connection name if it isn't your default one, for example:

```
$user = DB::connection('myOdbcConnection')->select('SELECT * FROM USERS WHERE id = :id', ['id' => 1]);
$users = DB::connection('myOdbcConnection')->table('USERS')->where('id', 1)->get();
```

If you're running raw queries make sure to use parameter bindings wherever possible to avoid SQL Injection vulnerabilities.

###  Health Score

36

—

LowBetter than 82% of packages

Maintenance18

Infrequent updates — may be unmaintained

Popularity32

Limited adoption so far

Community13

Small or concentrated contributor base

Maturity67

Established project with proven stability

 Bus Factor1

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

Every ~224 days

Recently: every ~240 days

Total

6

Last Release

1302d ago

PHP version history (2 changes)6.0.0PHP ^7.2

6.0.5PHP ^7.2|^8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/13980973?v=4)[Kuba Szymanowski](/maintainers/KKSzymanowski)[@KKSzymanowski](https://github.com/KKSzymanowski)

---

Top Contributors

[![KKSzymanowski](https://avatars.githubusercontent.com/u/13980973?v=4)](https://github.com/KKSzymanowski "KKSzymanowski (9 commits)")[![dependabot[bot]](https://avatars.githubusercontent.com/in/29110?v=4)](https://github.com/dependabot[bot] "dependabot[bot] (3 commits)")[![philippe-randour](https://avatars.githubusercontent.com/u/29437635?v=4)](https://github.com/philippe-randour "philippe-randour (2 commits)")

### Embed Badge

![Health badge](/badges/kkszymanowski-laravel-6-odbc/health.svg)

```
[![Health](https://phpackages.com/badges/kkszymanowski-laravel-6-odbc/health.svg)](https://phpackages.com/packages/kkszymanowski-laravel-6-odbc)
```

###  Alternatives

[mongodb/laravel-mongodb

A MongoDB based Eloquent model and Query builder for Laravel

7.1k7.2M71](/packages/mongodb-laravel-mongodb)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[dyrynda/laravel-model-uuid

This package allows you to easily work with UUIDs in your Laravel models.

4802.8M8](/packages/dyrynda-laravel-model-uuid)[mehdi-fathi/eloquent-filter

Eloquent Filter adds custom filters automatically to your Eloquent Models in Laravel.It's easy to use and fully dynamic, just with sending the Query Strings to it.

450191.6k1](/packages/mehdi-fathi-eloquent-filter)[pdphilip/elasticsearch

An Elasticsearch implementation of Laravel's Eloquent ORM

145360.2k4](/packages/pdphilip-elasticsearch)[clickbar/laravel-magellan

This package provides functionality for working with the postgis extension in Laravel.

423715.4k1](/packages/clickbar-laravel-magellan)

PHPackages © 2026

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