PHPackages                             srjlewis/aura-sql - 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. srjlewis/aura-sql

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

srjlewis/aura-sql
=================

A PDO extension that provides lazy connections, array quoting, query profiling, value binding, and convenience methods for common fetch styles. Because it extends PDO, existing code that uses PDO can use this without any changes to the existing code.

6.0.1(1y ago)128↓66.7%MITPHPPHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4CI passing

Since Nov 29Pushed 11mo agoCompare

[ Source](https://github.com/srjlewis/Aura.Sql)[ Packagist](https://packagist.org/packages/srjlewis/aura-sql)[ Docs](https://github.com/auraphp/Aura.Sql)[ RSS](/packages/srjlewis-aura-sql/feed)WikiDiscussions 6.x Synced 1mo ago

READMEChangelogDependencies (3)Versions (42)Used By (0)

Aura.Sql
========

[](#aurasql)

Provides an extension to the native [PDO](http://php.net/PDO) along with a profiler and connection locator. Because *ExtendedPdo* is an extension of the native *PDO*, code already using the native *PDO* or typehinted to the native *PDO* can use *ExtendedPdo* without any changes.

Added functionality in *Aura.Sql* over the native *PDO* includes:

- **Lazy connection.** *ExtendedPdo* connects to the database only on method calls that require a connection. This means you can create an instance and not incur the cost of a connection if you never make a query.
- **Decoration.** *DecoratedPdo* can be used to decorate an existing PDO instance. This means that a PDO instance can be "extended" **at runtime** to provide the *ExtendedPdo* behaviors.
- **Array quoting.** The `quote()` method will accept an array as input, and return a string of comma-separated quoted values.
- **New `perform()` method.** The `perform()` method acts just like `query()`, but binds values to a prepared statement as part of the call. In addition, placeholders that represent array values will be replaced with comma- separated quoted values. This means you can bind an array of values to a placeholder used with an `IN (...)` condition when using `perform()`.
- **New `fetch*()` methods.** The new `fetch*()` methods provide for commonly-used fetch actions. For example, you can call `fetchAll()` directly on the instance instead of having to prepare a statement, bind values, execute, and then fetch from the prepared statement. All of the `fetch*()`methods take an array of values to bind to to the query statement, and use the new `perform()` method internally.
- **New `yield*()` methods.** These are complements to the `fetch*()` methods that `yield` results instead of `return`ing them.
- **Exceptions by default.** *ExtendedPdo* starts in the `ERRMODE_EXCEPTION`mode for error reporting instead of the `ERRMODE_SILENT` mode.
- **Profiler.** An optional query profiler is provided, along with an interface for other implementations, that logs to any PSR-3 interface.
- **Connection locator.** A optional lazy-loading service locator is provided for picking different database connections (default, read, and write).

Installation and Autoloading
----------------------------

[](#installation-and-autoloading)

This package is installable and PSR-4 autoloadable via Composer as [aura/sql](https://packagist.org/packages/aura/sql).

Alternatively, [download a release](https://github.com/auraphp/Aura.Sql/releases), or clone this repository, then map the `Aura\Sql\` namespace to the package `src/` directory.

Dependencies
------------

[](#dependencies)

Version 6.x is compatible with PHP 8.4 and above. If you're running PHP 8.1-8.3, please use version 5.x. We recommend using the latest available version of PHP as a matter of principle.

Aura library packages may sometimes depend on external interfaces, but never on external implementations. This allows compliance with community standards without compromising flexibility. For specifics, please examine the package [composer.json](./composer.json) file.

Quality
-------

[](#quality)

[![Scrutinizer Code Quality](https://camo.githubusercontent.com/334e34c2d720723c997fa16abed11a3f7e7dfc9d9d7b98f1e1b92779c9cb67b4/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617572617068702f417572612e53716c2f6261646765732f7175616c6974792d73636f72652e706e673f623d352e78)](https://scrutinizer-ci.com/g/auraphp/Aura.Sql/)[![Code Coverage](https://camo.githubusercontent.com/dde3081b57ec4fea55496986693c236acd75d6c9c4fdcca8d2f6fa31fecfff32/68747470733a2f2f7363727574696e697a65722d63692e636f6d2f672f617572617068702f417572612e53716c2f6261646765732f636f7665726167652e706e673f623d352e78)](https://scrutinizer-ci.com/g/auraphp/Aura.Sql/)[![Build Status](https://github.com/auraphp/Aura.Sql/actions/workflows/continuous-integration.yml/badge.svg?branch=5.x)](https://github.com/auraphp/Aura.Sql/actions/workflows/continuous-integration.yml)[![PDS Skeleton](https://camo.githubusercontent.com/50d01a5094afcc3a827c3cadaec43d23b2a256cb249f5fdd6e5ffdb53ea7971c/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7064732d736b656c65746f6e2d626c75652e7376673f7374796c653d666c61742d737175617265)](https://github.com/php-pds/skeleton)

This project adheres to [Semantic Versioning](http://semver.org/).

To run the unit tests at the command line, issue `composer install` and then `./vendor/bin/phpunit` at the package root. (This requires [Composer](http://getcomposer.org/) to be available as `composer`.)

This package attempts to comply with [PSR-1](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md), [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md), and [PSR-4](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-4-autoloader.md). If you notice compliance oversights, please send a patch via pull request.

Community
---------

[](#community)

To ask questions, provide feedback, or otherwise communicate with other Aura users, please join our [Google Group](http://groups.google.com/group/auraphp), follow [@auraphp](http://twitter.com/auraphp), or chat with us on Freenode in the #auraphp channel.

Documentation
-------------

[](#documentation)

This package is fully documented [here](./docs/index.md).

###  Health Score

45

—

FairBetter than 93% of packages

Maintenance47

Moderate activity, may be stable

Popularity9

Limited adoption so far

Community19

Small or concentrated contributor base

Maturity93

Battle-tested with a long release history

 Bus Factor3

3 contributors hold 50%+ of commits

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

Recently: every ~34 days

Total

40

Last Release

356d ago

Major Versions

3.1.0 → 4.x-dev2022-04-28

3.x-dev → 5.0.22023-06-12

5.0.2 → 6.0.02025-01-09

5.0.4 → 6.0.12025-01-23

5.0.5 → 6.x-dev2025-05-27

PHP version history (7 changes)1.0.0PHP &gt;=5.4.0

2.0.0-beta1PHP &gt;=5.3.0

3.0.0-alpha1PHP &gt;=5.6.0

5.0.0PHP &gt;=8.1

4.0.0PHP &gt;=7.2

6.0.0PHP ^8.0 || ^8.1 || ^8.2 || ^8.3 || ^8.4

5.0.4PHP ^8.1 || ^8.2 || ^8.3

### Community

Maintainers

![](https://www.gravatar.com/avatar/5b23419c7fdf812c6845c93a1de108d912f204ac2d77cbba7c9789621aa3f1aa?d=identicon)[srjlewis](/maintainers/srjlewis)

---

Top Contributors

[![harikt](https://avatars.githubusercontent.com/u/120454?v=4)](https://github.com/harikt "harikt (71 commits)")[![srjlewis](https://avatars.githubusercontent.com/u/56001?v=4)](https://github.com/srjlewis "srjlewis (43 commits)")[![koriym](https://avatars.githubusercontent.com/u/529021?v=4)](https://github.com/koriym "koriym (28 commits)")[![MAXakaWIZARD](https://avatars.githubusercontent.com/u/1138453?v=4)](https://github.com/MAXakaWIZARD "MAXakaWIZARD (25 commits)")[![JLacoude](https://avatars.githubusercontent.com/u/605248?v=4)](https://github.com/JLacoude "JLacoude (21 commits)")[![pavarnos](https://avatars.githubusercontent.com/u/589595?v=4)](https://github.com/pavarnos "pavarnos (15 commits)")[![kenjis](https://avatars.githubusercontent.com/u/87955?v=4)](https://github.com/kenjis "kenjis (9 commits)")[![frederikbosch](https://avatars.githubusercontent.com/u/1552577?v=4)](https://github.com/frederikbosch "frederikbosch (9 commits)")[![stanlemon](https://avatars.githubusercontent.com/u/86314?v=4)](https://github.com/stanlemon "stanlemon (7 commits)")[![brandonsavage](https://avatars.githubusercontent.com/u/197889?v=4)](https://github.com/brandonsavage "brandonsavage (5 commits)")[![iansltx](https://avatars.githubusercontent.com/u/472804?v=4)](https://github.com/iansltx "iansltx (4 commits)")[![nyamsprod](https://avatars.githubusercontent.com/u/51073?v=4)](https://github.com/nyamsprod "nyamsprod (4 commits)")[![mbrevda](https://avatars.githubusercontent.com/u/293004?v=4)](https://github.com/mbrevda "mbrevda (3 commits)")[![pmjones](https://avatars.githubusercontent.com/u/25754?v=4)](https://github.com/pmjones "pmjones (3 commits)")[![tzappa](https://avatars.githubusercontent.com/u/140298?v=4)](https://github.com/tzappa "tzappa (2 commits)")[![auroraeosrose](https://avatars.githubusercontent.com/u/282573?v=4)](https://github.com/auroraeosrose "auroraeosrose (2 commits)")[![ramirovarandas](https://avatars.githubusercontent.com/u/15105992?v=4)](https://github.com/ramirovarandas "ramirovarandas (2 commits)")[![TheMY3](https://avatars.githubusercontent.com/u/9335727?v=4)](https://github.com/TheMY3 "TheMY3 (2 commits)")[![jblotus](https://avatars.githubusercontent.com/u/382230?v=4)](https://github.com/jblotus "jblotus (1 commits)")[![jakeasmith](https://avatars.githubusercontent.com/u/234832?v=4)](https://github.com/jakeasmith "jakeasmith (1 commits)")

---

Tags

mysqlsqlitepostgresqlpostgrespdopgsqlsqlserversqlsrvsql server

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/srjlewis-aura-sql/health.svg)

```
[![Health](https://phpackages.com/badges/srjlewis-aura-sql/health.svg)](https://phpackages.com/packages/srjlewis-aura-sql)
```

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k578.4M5.6k](/packages/doctrine-dbal)[aura/sql

A PDO extension that provides lazy connections, array quoting, query profiling, value binding, and convenience methods for common fetch styles. Because it extends PDO, existing code that uses PDO can use this without any changes to the existing code.

5632.5M43](/packages/aura-sql)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4572.9M34](/packages/aura-sqlquery)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41234.1k4](/packages/aura-sqlschema)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41249.0k7](/packages/atlas-query)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86946.7k](/packages/ezsql-ezsql)

PHPackages © 2026

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