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 .

06PHP

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 1w ago

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

16

—

LowBetter than 5% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity30

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

[doctrine/orm

Object-Relational-Mapper for PHP

10.2k285.3M6.2k](/packages/doctrine-orm)[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.4k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M546](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M211](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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