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

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

jeidison/named-query
====================

Package para armazenar SQL's

0.8.0(4y ago)42.7k↓100%MITPHPPHP ^7.2|^8.0

Since Mar 29Pushed 4y ago1 watchersCompare

[ Source](https://github.com/jeidison/named-query)[ Packagist](https://packagist.org/packages/jeidison/named-query)[ RSS](/packages/jeidison-named-query/feed)WikiDiscussions master Synced today

READMEChangelog (8)Dependencies (2)Versions (9)Used By (0)

[![Build Status](https://camo.githubusercontent.com/284eb3285048d0537ec1539ed9559140bc0ddf32651850c9ec0bab72c3e17e6e/68747470733a2f2f7472617669732d63692e6f72672f6a65696469736f6e2f6e616d65642d71756572792e7376673f6272616e63683d6d6173746572)](https://travis-ci.org/jeidison/named-query)

Instalação
==========

[](#instalação)

Instalação via composer
=======================

[](#instalação-via-composer)

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

Publicando as configurações
===========================

[](#publicando-as-configurações)

```
$ php artisan vendor:publish --provider="Jeidison\NamedQuery\Providers\NamedQueryServiceProvider"
```

Esse comando publicará a configuração `config/named-query.php` do pacote para ser customizado.

```
return [
    'path-sql'  => database_path('named-query/queries'),
    'type'      => Jeidison\NamedQuery\Enums\TypeFile::XML,
    'type-bind' => Jeidison\NamedQuery\Enums\TypeBind::TWO_POINTS,
];
```

Adicionando uma SQL em arquivo XML
==================================

[](#adicionando-uma-sql-em-arquivo-xml)

```

    SELECT * FROM TAB1 WHERE PAR1 = ?1

```

Adicionando uma SQL em arquivo PHP
==================================

[](#adicionando-uma-sql-em-arquivo-php)

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

Atenção
=======

[](#atenção)

- Se você configurar o type no arquivo `config/named-query.php` como `Jeidison\NamedQuery\Enums\TypeFile::XML` todas SQLs devem estar em arquivo XML.
- Se você configurar o type no arquivo `config/named-query.php` como `Jeidison\NamedQuery\Enums\TypeFile::PHP` todas SQLs devem estar em arquivo PHP.

Executando uma SQL
==================

[](#executando-uma-sql)

```
NamedQuery::executeNamedQuery('find_tab1', 'nfe/named-querys', [
    'PAR1' => $numero,
]);
```

Desta forma a SQL será executada e o resultado da consulta será do tipo stdClass. Caso queira um tipo diferente, execute da sequinte forma:

Executando uma SQL com ResultClass
==================================

[](#executando-uma-sql-com-resultclass)

```
NamedQuery::executeNamedQuery('find_nfe_by_key', 'nfe/named-querys', [
    'numero'        => $numero,
    'cnpj_emitente' => $cnpjEmitente,
    'serie'         => $serie,
    'tpamb'         => $tpAmb,
    'mod'           => $mod,
], NFe::class);
```

Debugando a SQL construída
==========================

[](#debugando-a-sql-construída)

```
NamedQuery::executeNamedQuery('find_nfe_by_key', 'nfe/named-querys', [
    'numero'        => $numero,
    'cnpj_emitente' => $cnpjEmitente,
    'serie'         => $serie,
    'tpamb'         => $tpAmb,
    'mod'           => $mod,
], NFe::class, true);
```

###  Health Score

32

—

LowBetter than 74% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity23

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity63

Established project with proven stability

 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 ~180 days

Recently: every ~255 days

Total

8

Last Release

1652d ago

PHP version history (3 changes)0.1PHP &gt;=5.3.0

0.6PHP ^7.2

0.8.0PHP ^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 (29 commits)")

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k280.5M5.7k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k114.4M88](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k51.5M8.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k62.7M501](/packages/mongodb-mongodb)[maxmind-db/reader

MaxMind DB Reader API

69796.7M45](/packages/maxmind-db-reader)[spatie/db-dumper

Dump databases

1.2k25.1M58](/packages/spatie-db-dumper)

PHPackages © 2026

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