PHPackages                             squirrelphp/connection - 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. squirrelphp/connection

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

squirrelphp/connection
======================

Slimmed down concise connection interface for database queries and transactions supporting MySQL, MariaDB, PostgreSQL and SQLite.

v0.3.6(5mo ago)01552MITPHPPHP &gt;=8.4

Since Jul 26Pushed 5mo ago1 watchersCompare

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

READMEChangelog (10)Dependencies (7)Versions (11)Used By (2)

Squirrel Connection
===================

[](#squirrel-connection)

[![Test Coverage](https://camo.githubusercontent.com/4871ec13b04f4b8b821288b76158cb0029ec8a4519b1dfd31fdbf4cb9be12d86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d38332532352d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d74657374253230636f766572616765)](https://camo.githubusercontent.com/4871ec13b04f4b8b821288b76158cb0029ec8a4519b1dfd31fdbf4cb9be12d86/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d38332532352d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d74657374253230636f766572616765) [![PHPStan](https://camo.githubusercontent.com/2f409849f7a47b1ac5bed1d59b866f287a76ad211c6bf3a10263d769a3354579/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c2532306d61782d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d7068707374616e)](https://camo.githubusercontent.com/2f409849f7a47b1ac5bed1d59b866f287a76ad211c6bf3a10263d769a3354579/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f7374796c652d6c6576656c2532306d61782d737563636573732e7376673f7374796c653d666c61742d726f756e64266c6162656c3d7068707374616e) [![Packagist Version](https://camo.githubusercontent.com/8f7a21837f94b2a2ab0272d0d54ae591ae1fb4b4944ab8a525486a3953a19302/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f737175697272656c7068702f636f6e6e656374696f6e2e7376673f7374796c653d666c61742d726f756e64)](https://packagist.org/packages/squirrelphp/connection) [![PHP Version](https://camo.githubusercontent.com/bfdd977f2991d2246ba8980d0a2c4514d175a97c9a65ef78c8048a28e4c402e1/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f737175697272656c7068702f636f6e6e656374696f6e2e737667)](https://packagist.org/packages/squirrelphp/connection) [![Software License](https://camo.githubusercontent.com/4f9c8f8c009336d7177cf697d694e2e763e5e707f1a6224ab0d295465eadffbd/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6c6963656e73652d4d49542d737563636573732e7376673f7374796c653d666c61742d726f756e64)](LICENSE)

Provides a slimmed down concise interface for the low level database connection (ConnectionInterface), as a more simple replacement to Doctrine DBAL and a more streamlined/opinionated interface compared to pure PDO. It supports MySQL, MariaDB, Sqlite and PostgreSQL and is currently based on PDO, although that is considered an implementation detail.

Much code for the exception handling was taken from Doctrine DBAL. This library is currently only internally used in [squirrelphp/queries](https://github.com/squirrelphp/queries) and should not be used on its own, as the API is not yet considered completely stable (it is stable-ish). Use [squirrelphp/queries](https://github.com/squirrelphp/queries) instead or even better, use [squirrelphp/entities](https://github.com/squirrelphp/entities) / [squirrelphp/entities-bundle](https://github.com/squirrelphp/entities-bundle) instead, as those are more high-level and stable and will abstract away much of the low-level pain points of databases.

A stable version of this package will eventually come out, once the API surface has been thought about more and there is more experience using this package within the other SquirrelPHP packages.

Common configuration for all connections
----------------------------------------

[](#common-configuration-for-all-connections)

The following options are hardcoded into all connections and mostly differ from the common defaults in PHP database connections:

- Emulation of prepares is turned off, so real query and values separation is enabled instead of emulating it (which is usually the default in PHP). You should not notice this in any way, even in terms of performance: it was tested, and when script and database are running in the same network there is no measureable difference. Your script and database would need to be apart by some distance for any possible effect to manifest. On the other hand, the separation of queries and values has undeniable security benefits and is the way the underlying database client libraries are designed to work.
- For MySQL/MariaDB, the "affected rows" reported for UPDATE queries (retrieved via `ConnectionInterface->rowCount()`) are the "found rows" in the database, even if nothing changed by executing the UPDATE. By default with MySQL/MariaDB in PHP you get the "changed rows", which is a behavior no other database has or even supports, so MySQL/MariaDB is configured to behave more like any other database. Getting the "found rows" count can be useful information, while relying on the "changed rows" count relies on special behavior in one database system.
- Executing multiple statements in one query is disabled. Multiple statements per query were a source of security exploits in the past, are often not easy to port between different database systems and have little real world relevance. Use transactions instead, which is a guaranteed way to execute multiple statements together, or use parallel connections / multiple connections if speed is an issue.

###  Health Score

39

—

LowBetter than 86% of packages

Maintenance72

Regular maintenance activity

Popularity12

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity54

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

Recently: every ~71 days

Total

10

Last Release

159d ago

PHP version history (2 changes)v0.1PHP &gt;=8.2

v0.3.6PHP &gt;=8.4

### Community

Maintainers

![](https://www.gravatar.com/avatar/8cd200dc74af2d77e8c480000a7e3bab0b8a98fae4b399d306b3d332354f8177?d=identicon)[iquito\_ch](/maintainers/iquito_ch)

---

Top Contributors

[![iquito](https://avatars.githubusercontent.com/u/973653?v=4)](https://github.com/iquito "iquito (11 commits)")

---

Tags

phpabstractiondatabasemysqlsqlitepgsqlConnection

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/squirrelphp-connection/health.svg)

```
[![Health](https://phpackages.com/badges/squirrelphp-connection/health.svg)](https://phpackages.com/packages/squirrelphp-connection)
```

###  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)[vcian/laravel-db-auditor

Database DB Auditor provide leverage to audit your MySql,sqlite, PostgreSQL database standards and also provide options to add constraints in table.

28535.1k1](/packages/vcian-laravel-db-auditor)[delight-im/db

Safe and convenient SQL database access in a driver-agnostic way

49156.8k7](/packages/delight-im-db)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1814.6k11](/packages/popphp-pop-db)

PHPackages © 2026

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