PHPackages                             jeidison/native-query - 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. jeidison/native-query

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

jeidison/native-query
=====================

Laravel package for save native query in external file.

0.12.0(4y ago)13.0k↓100%MITPHPPHP ^7.2|^8.0

Since Aug 26Pushed 3y ago1 watchersCompare

[ Source](https://github.com/jeidison/native-query)[ Packagist](https://packagist.org/packages/jeidison/native-query)[ RSS](/packages/jeidison-native-query/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (1)Versions (12)Used By (0)

Installation
============

[](#installation)

```
$ composer require jeidison/native-query
```

Publish Settings
================

[](#publish-settings)

```
$ php artisan vendor:publish --provider="Jeidison\NativeQuery\Provider\NativeQueryServiceProvider"
```

This will add the nativequery.php file in your config directory with the following contents:

```
return [
    'path-sql' => database_path('native-query'),
    'type' => Jeidison\NativeQuery\Enums\FileType::PHP,
];
```

And this will add the native-query.xml file in your database directory with the following contents:

SQL in file XML
===============

[](#sql-in-file-xml)

```

    SELECT * FROM TAB1 WHERE PAR1 = ?

```

And this will add the native-query.php file in your database directory with the following contents:

SQL in file PHP
===============

[](#sql-in-file-php)

```
CONST findTab1 = "
SELECT * FROM TAB1 WHERE PAR1 = :par1
";
```

Add Trait in model
==================

[](#add-trait-in-model)

```
...

class ModelX extends Model
{
    use HasNativeQuery;

    protected $queryFile = '/path/file-with-queries';

    ...
}
```

Executing SQL
=============

[](#executing-sql)

```
ModelX::nativeQuery('findTab1')->param('par1', 'value1')->param('par2', 'value2')->exec();

ModelX::nativeQuery('findTab1')->param(['par1' => 'value1'])->exec();

ModelX::nativeQuery('findTab1')->param(['par1' => 'value1'])->->debug();

NativeQuery::query('findTab1')
            ->queryFile('/path/file-with-queries')
            ->param('par1', 'value1')
            ->exec();
```

###  Health Score

30

—

LowBetter than 64% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity21

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~85 days

Recently: every ~102 days

Total

11

Last Release

1598d ago

PHP version history (2 changes)0.1PHP ^7.2

0.9PHP ^7.2|^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/672f00a9bee58935e9851abc9ae1c1dfa05da76f684e08c183b5aa1ef9020e0e?d=identicon)[jeidison](/maintainers/jeidison)

---

Top Contributors

[![jeidison](https://avatars.githubusercontent.com/u/12176232?v=4)](https://github.com/jeidison "jeidison (24 commits)")

---

Tags

laravelphpsql

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jeidison-native-query/health.svg)

```
[![Health](https://phpackages.com/badges/jeidison-native-query/health.svg)](https://phpackages.com/packages/jeidison-native-query)
```

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M540](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M208](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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