PHPackages                             phpnomad/sqlite-integration - 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. phpnomad/sqlite-integration

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

phpnomad/sqlite-integration
===========================

PDO+SQLite implementation of phpnomad/db strategies. Pairs with phpnomad/mysql-integration so entity classes and repositories are portable between MySQL (server) and SQLite (desktop/local).

v1.0.0(1mo ago)00MITPHPPHP ^8.3CI passing

Since May 26Pushed 1mo agoCompare

[ Source](https://github.com/phpnomad/sqlite-integration)[ Packagist](https://packagist.org/packages/phpnomad/sqlite-integration)[ Docs](https://github.com/phpnomad/sqlite-integration)[ RSS](/packages/phpnomad-sqlite-integration/feed)WikiDiscussions main Synced 1w ago

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

phpnomad/sqlite-integration
===========================

[](#phpnomadsqlite-integration)

[![Latest Version](https://camo.githubusercontent.com/f6fde33fa889a0d620bc1292b649ab882fc4eca89c20e7b246d918c28e256493/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7068706e6f6d61642f73716c6974652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/sqlite-integration)[![Total Downloads](https://camo.githubusercontent.com/85b0d8683784be62e21ac2bc95c337a74fe719f730233e863bfbe7d6902d1f95/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7068706e6f6d61642f73716c6974652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/sqlite-integration)[![PHP Version](https://camo.githubusercontent.com/6b015930c330c8bcb598b95ba3f748cd223519f090c29f9ffd9b639a5fe6d08c/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f7068706e6f6d61642f73716c6974652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/sqlite-integration)[![License](https://camo.githubusercontent.com/18118352cc22332e8ea49fd43b692a8ffb92c3ec4a99a344bc82091d8194201f/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f6c2f7068706e6f6d61642f73716c6974652d696e746567726174696f6e2e737667)](https://packagist.org/packages/phpnomad/sqlite-integration)

`phpnomad/sqlite-integration` implements `phpnomad/db`'s query builders and table strategies for SQLite via PDO. It opens its own connection (configured by DSN), generates SQLite-flavored SQL, and exposes the same strategy interfaces that `phpnomad/mysql-integration` does — so entity classes, repositories, and validation are portable between MySQL and SQLite.

The intended use case is the **local-storage half of a desktop app** whose server uses `phpnomad/mysql-integration`. Same models on both sides, only the strategy binding differs.

Installation
------------

[](#installation)

```
composer require phpnomad/sqlite-integration
```

What This Provides
------------------

[](#what-this-provides)

- A `QueryBuilder` and `ClauseBuilder` that emit SQLite-flavored SQL for SELECT, JOIN, GROUP BY, ORDER BY, LIMIT, OFFSET, and the full set of comparison operators (including IS NULL, IN, BETWEEN, and AND/OR groups)
- `QueryStrategy`, `TableCreateStrategy`, `TableDeleteStrategy`, `TableExistsStrategy`, and `TableUpdateStrategy` implementations covering insert, update, delete, query, estimated count, and schema management
- `TableUpdateStrategy::syncColumns` handles SQLite's limited ALTER — simple ADD/DROP COLUMN for the common case, transactional create-copy-drop-rename for affinity changes
- `PdoDatabaseStrategy` — a PDO-backed `DatabaseStrategy` that parses SafeMySQL-style placeholders (`?n`, `?s`, `?i`, `?d`, `?a`) so the builders speak the same language as the MySQL pipeline
- `Connection` — a thin PDO wrapper that turns on foreign keys and WAL journaling by default
- `DatabaseDateAdapter` that round-trips `DateTime` through the same `Y-m-d H:i:s` format the MySQL adapter uses
- A `Database` facade exposing `parse()`, `query()`, and `lastInsertId()` for the bound `DatabaseStrategy`

Requirements
------------

[](#requirements)

- PHP 8.3+ with `pdo` and `pdo_sqlite` extensions
- `phpnomad/db`
- `phpnomad/loader ^1.0 || ^2.0`

This package supplies its own `DatabaseStrategy` (`PdoDatabaseStrategy`) — unlike `phpnomad/mysql-integration`, you do not need a separate driver package.

Usage
-----

[](#usage)

Add `Initializer` to your bootstrapper. The integration registers every builder, strategy, and adapter listed above.

```
