PHPackages                             nixphp/database - 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. nixphp/database

ActiveNixphp-plugin[Database &amp; ORM](/categories/database)

nixphp/database
===============

NixPHP Database Plugin to work with various storage solutions.

v0.1.3(2mo ago)01391MITPHPPHP &gt;=8.3CI passing

Since Nov 30Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/nixphp/database)[ Packagist](https://packagist.org/packages/nixphp/database)[ RSS](/packages/nixphp-database/feed)WikiDiscussions main Synced 1mo ago

READMEChangelog (4)Dependencies (3)Versions (9)Used By (1)

[![Logo](https://camo.githubusercontent.com/075b2860e9651b98b8c190a8296595c54cff6900890d9e494f31131145e98a6f/68747470733a2f2f6e69787068702e6769746875622e696f2f646f63732f6173736574732f6e69787068702d6c6f676f2d736d616c6c2d7371756172652e706e67)](https://camo.githubusercontent.com/075b2860e9651b98b8c190a8296595c54cff6900890d9e494f31131145e98a6f/68747470733a2f2f6e69787068702e6769746875622e696f2f646f63732f6173736574732f6e69787068702d6c6f676f2d736d616c6c2d7371756172652e706e67)

[![NixPHP Database Plugin](https://github.com/nixphp/database/actions/workflows/php.yml/badge.svg)](https://github.com/nixphp/database/actions/workflows/php.yml)

[← Back to NixPHP](https://github.com/nixphp/framework)

---

nixphp/database
===============

[](#nixphpdatabase)

> **Simple, native PDO connection for your NixPHP application.**

This plugin provides a shared **PDO instance** via the service container, supporting both **MySQL/MariaDB** and **SQLite** out of the box — with sensible defaults.

> 🧩 Part of the official NixPHP plugin collection. Install it when you need a native, PSR-compliant database connection — and nothing more.

---

📦 Features
----------

[](#-features)

- ✅ Shared `PDO` instance, ready to use
- ✅ MySQL/MariaDB and SQLite support
- ✅ Uses sane defaults (error mode, fetch mode, UTF-8 charset)
- ✅ Works with memory databases (`sqlite::memory:`)
- ✅ Available via `database()` helper or DI container

---

📥 Installation
--------------

[](#-installation)

```
composer require nixphp/database
```

Then add the following configuration to `/app/config.php`. You can choose between **MySQL/MariaDB** or **SQLite**.

### Example: MySQL

[](#example-mysql)

```
