PHPackages                             kmucms/dbsqlite - 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. kmucms/dbsqlite

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

kmucms/dbsqlite
===============

Helping classed to use SQLite DB .

07PHP

Since Mar 11Pushed 5y ago1 watchersCompare

[ Source](https://github.com/kmucms/dbsqlite)[ Packagist](https://packagist.org/packages/kmucms/dbsqlite)[ RSS](/packages/kmucms-dbsqlite/feed)WikiDiscussions master Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

Helping classes for using sqlite db.

!!! If data are important, don't forget to make backups !!!

WORKING WITH DB
---------------

[](#working-with-db)

```
//to make live easier i use allways tables with a column='id'

$db = new \kmucms\dbsqlite\DbSqlite('/path/to/file.sqli');

//read some rows
$row = $db->getRow("select * from page where id=5 limit 1");
$rows = $db->getRows("select * from page where id=5");
$rows = $db->getRows("select * from page where id=:id",['id'=>5]);
$row = $db->getRowById('page', 3);
$rows = $db->getRowByColumn('page', 'type', 'news'); // all rows with type='news'
$count = $db->getRowsCount('person', "first_name like 'a%'");

//manipulate some rows
$id = $db->addRow('person', ['first_name'=>'Max','last_name'=>'Maier']);
$db->setRow('person', $id, ['first_name'=>'Peter']);
$db->removeRow('person', $id);
$db->doExecute("update person set access=1 where event_group=:group ",['group'=>'musicLovers']);
```

In my opinion SQL language is short and nice ... does not need more abstaction.

CREATING DB
-----------

[](#creating-db)

```
$schemaDescription = [
    'version' => 1,
    'tables' => [
        [
            'name' => 'person',
            'columns' => [
                [
                    'name' => 'first_name',
                    'type' => 'TEXT',  //INTEGER,REAL,TEXT,BLOB,NUMERIC
                    'default' => 'Maxim',
                ],
                [
                    'name' => 'last_name',
                    'type' => 'TEXT',
                    'default' => 'Maier',
                ],
            ],
        ],
        [
            'name' => 'car',
            'columns' => [
                [
                    'name' => 'brand',
                    'type' => 'TEXT',
                ],
                [
                    'name' => 'price',
                    'type' => 'INTEGER',
                ],
            ],
        ],
    ],
/*
    'rename' => [
        'tables' => [
            'bike' => 'car',
            //'fromTable' => 'toTable',
        ],
        'columns' => [
            'car' => [
                'value' => 'price',
                //'fromColumn' => 'toColumn',
            ],
        ],
    ],
*/
];

$c = new \kmucms\dbsqlite\DbSchemaSqlite(__DIR__.'/file.sqli', $schemaDescription);
$c->update();
```

Set version +1 if something has changed and schema needs an update.

"rename" section is performed first, so remove it if there is nothing to rename. Rename tables is the first renaming. Rename columns is the second renaming, for columns use only the new table-names.

The **id** -row is added to every table.

**db\_schema\_info** table is added to track current version.

For now I don't use foreign keys.

###  Health Score

17

—

LowBetter than 6% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity31

Early-stage or recently created project

 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.

### Community

Maintainers

![](https://www.gravatar.com/avatar/ed58ea775163acc3617675f67da3d61ca3aa17b1b692c9516d203f12e055ba5c?d=identicon)[waleri](/maintainers/waleri)

---

Top Contributors

[![kmucms](https://avatars.githubusercontent.com/u/79286716?v=4)](https://github.com/kmucms "kmucms (7 commits)")

### Embed Badge

![Health badge](/badges/kmucms-dbsqlite/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.8k117.8M121](/packages/jdorn-sql-formatter)[backup-manager/backup-manager

A framework agnostic database backup manager with user-definable procedures and support for S3, Dropbox, FTP, SFTP, and more with drivers for popular frameworks.

1.7k1.6M11](/packages/backup-manager-backup-manager)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M88](/packages/propel-propel1)[insolita/yii2-migration-generator

Set of gii tools for generating files for migration by schema of table , phpdoc or table data

108508.0k5](/packages/insolita-yii2-migration-generator)[xpdo/xpdo

A PDO-based Object/Relational Bridge Library

7088.4k4](/packages/xpdo-xpdo)[voku/session2db

A PHP library acting as a wrapper for PHP's default session handling functions which stores data in a MySQL database, providing both better performance and better security and protection against session fixation and session hijacking.

2920.0k](/packages/voku-session2db)

PHPackages © 2026

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