PHPackages                             thipages/sqlitecli - 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. thipages/sqlitecli

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

thipages/sqlitecli
==================

SQLite CLI PHP wrapper

v0.5.3(4y ago)2482MITPHP

Since Jul 27Pushed 4y ago1 watchersCompare

[ Source](https://github.com/thipages/sqlitecli)[ Packagist](https://packagist.org/packages/thipages/sqlitecli)[ RSS](/packages/thipages-sqlitecli/feed)WikiDiscussions master Synced 1w ago

READMEChangelog (9)DependenciesVersions (10)Used By (2)

sqlitecli
=========

[](#sqlitecli)

SQLite CLI wrapper

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

[](#installation)

**composer** require thipages\\sqlitecli

Usage
-----

[](#usage)

```
/* index.php */
/* ********* */
$cli=new SqliteCli('./database.db');
$cli->execute(
    "CREATE TABLE simple (id INTEGER PRIMARY KEY, name);",
    "INSERT INTO simple (name) VALUES ('Paul'), ('Jack'),('Charlie');",
    '.mode csv',
    '.headers on',
    '.separator ,',
    '.output data.csv',
    'select id,name from simple limit 2;'
);
// OR
$cli-execute(
    "CREATE TABLE simple (id INTEGER PRIMARY KEY, name);",
    "INSERT INTO simple (name) VALUES ('Paul'), ('Jack'),('Charlie');",
    "SELECT name FROM simple WHERE id=1;",
    function($res) {
        // Set 'Paul' to all records
        return "UPDATE simple SET name='$res'";
    }
);
```

- with functions and registry

```
/* index.php */
/* ********* */
$cli=new SqliteCli('./database.db');
$cli->execute(
    "CREATE TABLE simple (id INTEGER PRIMARY KEY, name);",
    "INSERT INTO simple (name) VALUES ('Paul'), ('Jack'),('Charlie');",
    "SELECT name FROM simple WHERE id=1;",
    Orders::registerAs('QUERY_ID=1'),
    function($res, $registry) {
        $newName=$registry->get(''QUERY_ID=1'');
        return "UPDATE simple SET name='$newName'";
    }
);
```

Same result for both.

API
---

[](#api)

**SqliteCli class**

###### Constructor

[](#constructor)

`SqliteCli($dbPath)`

###### Methods

[](#methods)

`execute(...$orders):[boolean,array]` executes sqlite commands (list of \[array of\] commands). This method adds a final `.quit` command

`getRegistry($key=null)` get the registry ouput value of `$key` or if null the registry as an associated array.

**Orders class**

###### Static methods

[](#static-methods)

`addPrimary($table,$primaryName):[boolean,array]` adds a primary field to an existing table (first position)

`addField($table,$definition):[boolean,array]` adds a field to an existing table (first position)

`importCsv($table, $csvPath, $separator=',', $headers='on'):array` returns an array of commands for csv import

`exportCsv($csvPath, $separator=',', $headers='on'):array` returns an array of commands for csv export

`mergeCsvList($table,$csvPaths, $delimiter=',')` merges csv Files into `$table`. Files need to have the same fields. `$delimiter` can be an array matching `$csvPaths`

`getFieldList($table)` returns an array of the fields of `$table`

`registerAs($key)` associates the previous output command to `$key` in the registry

`unregister(...$keys)` associates the previous output command to `$key` in the registry

###  Health Score

25

—

LowBetter than 37% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity11

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity51

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

Recently: every ~0 days

Total

9

Last Release

1743d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/130309?v=4)[tit](/maintainers/thipages)[@thipages](https://github.com/thipages)

---

Top Contributors

[![thipages](https://avatars.githubusercontent.com/u/130309?v=4)](https://github.com/thipages "thipages (40 commits)")

---

Tags

cliphpsqlitewrapperphpclisqlitewrapper

### Embed Badge

![Health badge](/badges/thipages-sqlitecli/health.svg)

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

###  Alternatives

[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)[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11812.0k](/packages/stefangabos-zebra-database)[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)
