PHPackages                             julfiker/laravel-sqlsrv - 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. julfiker/laravel-sqlsrv

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

julfiker/laravel-sqlsrv
=======================

Laravel - SQL Server connectivity and procedure execute and othes

v1.6(3y ago)92.2k5MITPHPPHP &gt;=7.2

Since Dec 12Pushed 2y ago1 watchersCompare

[ Source](https://github.com/julfiker/laravel-sqlsrv)[ Packagist](https://packagist.org/packages/julfiker/laravel-sqlsrv)[ RSS](/packages/julfiker-laravel-sqlsrv/feed)WikiDiscussions main Synced 3w ago

READMEChangelog (2)DependenciesVersions (4)Used By (0)

laravel-sqlsrv
==============

[](#laravel-sqlsrv)

Before install make sure install sqlsrv and pdo\_sqlsrv for php
SQLSRV DB driver for Laravel
The Microsoft drivers is required to enable SQL server for PHP applications

**Install package by composer:**

```
 composer require julfiker/laravel-sqlsrv

```

**Post install:**
Configure the service into the applicaton, Please add following into the config/app.php under the providers
`Julfiker\SqlSrv\SqlSrvServiceProvider::class`

### Instruction to use into the laravel application to execute a procedure

[](#instruction-to-use-into-the-laravel-application-to-execute-a-procedure)

```
       $status_code = sprintf("%4000s", "");
       $status_message = sprintf("%4000s", "");
       $params = [
            "p_user_id" => 1, //OUTPUT parameter
            "o_status_code" => &$status_code, //OUT parameter
            "o_status_message" => &$status_message, // OUT parameter
        ];
       /** @var PDOStatement $sth */
       $sth = DB::executeProcedure('{SCHEMA_NAME}.{PROCEDURE_NAME}', $params);

       // If you have return sql statement from procedure you can use statement object $sth fetching data like as below
       $result = $sth->fetchAll();
       print_r($result);

```

You can use out parameters as you need that would bind from procedure end.

Also you can define parameter type and length in parameter like

```
     $params = [
            "p_user_id" => ['value' => 1, 'length' => 400,'type' => PDO::PARAM_INPUT_OUTPUT] //OUTPUT parameter
     ];

     //Note: If you want to assign base64 content with the procedure param then you can keep null into the type and length, otherwise you might got error.
```

### Instructions to set log into the database.

[](#instructions-to-set-log-into-the-database)

- Crate a table in database

```
create table ACCESS_LOG
            (
                ACTION_NAME   nvarchar(max),
                MODEL_NAME    nvarchar(max),
                PROCE_NAME    nvarchar(max),
                PARAMS_DATA   nvarchar(max),
                RESPONSE_DATA nvarchar(max),
                CREATED_AT    datetime,
                UPDATED_AT    datetime,
                CREATED_BY    bigint,
                UPDATED_BY    bigint,
                ROW_ID        varchar(max)
            )

```

- Add channel on \\config\\logging.php at line 37 to 43

```
  'channels' => [
         'auditLog' => [
             'driver' => 'custom',
             'handler' => App\AuditLog\LogHandler::class,
             'via' => App\AuditLog\LogSetter::class,
             'level' => 'debug',
         ],

```

- Copy the directory 'AuditLog' to \\app as the path \\app\\AuditLog

### Any Help?

[](#any-help)

You can contact me through following access
email: **
skype: *eng.jewel*

### you are welcome to contribute on it further improvement/update or extended usability for all. Just make a pull request.

[](#you-are-welcome-to-contribute-on-it-further-improvementupdate-or-extended-usability-for-all-just-make-a-pull-request)

Thank you

###  Health Score

28

—

LowBetter than 52% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity26

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity43

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 88.2% 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 ~32 days

Total

3

Last Release

1230d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/d2891c7040783336013e794b238f2389a61973e26002105f438ec1d74188601d?d=identicon)[julfiker](/maintainers/julfiker)

---

Top Contributors

[![julfiker](https://avatars.githubusercontent.com/u/3142932?v=4)](https://github.com/julfiker "julfiker (15 commits)")[![icepot247](https://avatars.githubusercontent.com/u/139423899?v=4)](https://github.com/icepot247 "icepot247 (2 commits)")

---

Tags

laravellaravel-packageopen-sourcephpsqlserversqlsrv

### Embed Badge

![Health badge](/badges/julfiker-laravel-sqlsrv/health.svg)

```
[![Health](https://phpackages.com/badges/julfiker-laravel-sqlsrv/health.svg)](https://phpackages.com/packages/julfiker-laravel-sqlsrv)
```

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)

PHPackages © 2026

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