PHPackages                             codethereal/sqlite-php - 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. codethereal/sqlite-php

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

codethereal/sqlite-php
======================

v2.0.0(4y ago)5489↓100%1PHPPHP ^8.0

Since Nov 2Pushed 4y ago2 watchersCompare

[ Source](https://github.com/dogukanakkaya/dawn-db)[ Packagist](https://packagist.org/packages/codethereal/sqlite-php)[ RSS](/packages/codethereal-sqlite-php/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (7)DependenciesVersions (8)Used By (0)

dawn-db
=======

[](#dawn-db)

Database drivers and query builder library for PHP

```
composer require dogukanakkaya/dawn-db

```

Include autoload file

```
include_once __DIR__ . "/vendor/autoload.php";
```

To use sqlite you must create a new file for database like **data.db** then create a new instance from **Sqlite** class. You must give the file path to constructor.

```
$sqlite = new Codethereal\Database\Driver\Sqlite('data.db');
$db = $sqlite->getQueryBuilder();
```

> Samples below valid for Sqlite driver only.

Reading
-------

[](#reading)

```
$resultSingle = $db->select('name,email,password')->getSingle('users'); // SELECT name,email,password FROM posts LIMIT 1
$result = $db->select('name,email,password')->get('users'); // SELECT name,email,password FROM posts

# For mode 1: it returns you an array with db column keys
# For mode 2: it returns you an array with index numbers
# For mode 3: it returns you an array with both column keys and index numbers
###*** You must use while loop on returned result, if you want you get only one record ***###
while ($row = $result->fetchArray(1)) {
    echo "";
    print_r($row);
    echo "";
}
```

- You should call `fetchArray(1)` method on `$resultSingle` too.

### Where

[](#where)

```
# Allowed where operators are: ['=', '>', '=', '', 2)->get('users'); // SELECT * FROM users WHERE id > 2
$db
    ->where('id', '>', 2)
    ->where('name', 'codethereal')
    ->get('users'); // SELECT * FROM users WHERE id > 2 AND name = 'codethereal'
```

### Or Where

[](#or-where)

```
$db->select('name,email')
    ->where('id', 5)
    ->orWhere('name', 'codethereal')
    ->getSingle('users'); // SELECT name,email FROM users WHERE id = 5 OR name = 'dogukan' LIMIT 1
```

### Nested Where

[](#nested-where)

```
$db->select('name,email')
    ->where('id', 5)
    ->orWhere(function (\Codethereal\Database\Builder\Query $query) {
        return $query
            ->where('name', 'codethereal')
            ->where('email', 'i@codethereal.com');
    })
    ->orWhere('name', 'codethereal')
    ->getSingle('users'); // SELECT name,email FROM users WHERE id = 5 OR (name = 'dogukan' AND email = 'i@codethereal.com') OR name = 'codethereal' LIMIT 1
```

### Where In/Not In

[](#where-innot-in)

```
$db->in('id', [1, 2])->get('users'); // SELECT * FROM users WHERE id IN (1,2)
$db->notIn('id', [1, 2])->get('users'); // SELECT * FROM users WHERE id NOT IN (1,2)
```

### Where Like/Not Like

[](#where-likenot-like)

```
$db->where('name', 'LIKE', 'Dogukan%')->get('users'); // SELECT * FROM users WHERE name LIKE 'Dogukan%'
$db->where('name', 'NOT LIKE', '%Codethereal%')->get('users'); // SELECT * FROM users WHERE name LIKE '%Codethereal%'
```

### Order By

[](#order-by)

```
$db->orderBy('name', 'ASC')->get('users'); // SELECT * FROM users ORDER BY name ASC
```

### Joins

[](#joins)

```
# Available join methods for sqlite are: ['INNER', 'CROSS', 'LEFT (OUTER)']
$db->select('users.name as userName, posts.name as postName')->join('users', 'users.id = posts.user_id', 'CROSS')->get('posts');
$db->select('users.name as userName, posts.name as postName')->join('users', 'users.id = posts.user_id', 'INNER')->get('posts');
```

### Count

[](#count)

```
$db->where('views', '>', 10)->count('posts'); // SELECT COUNT(*) as count FROM posts
```

- You should call `fetchArray(1)` method on this and get the count alias.

Creating
--------

[](#creating)

```
$db->insert('users', ['name' => 'Dogukan Akkaya', 'email' => 'doguakkaya27@gmail.com']); // INSERT INTO users (name, email) VALUES ('Dogukan Akkaya', 'doguakkaya27@gmail.com') | Returns insert id on success
```

Updating
--------

[](#updating)

```
$db->where('id', 1)->update('users', ['name' => 'Dogukan Akkaya | Codethereal', 'email' => 'doguakkaya27@codethereal.com']); // UPDATE users SET name = 'Dogukan Akkaya | Codethereal', email = 'doguakkaya27@codethereal.com' WHERE id = 1
```

Deleting
--------

[](#deleting)

```
$db->where('id', 1)->delete('users'); // DELETE FROM users WHERE id = 1
```

Transaction
-----------

[](#transaction)

```
# You don't have to wrap with try-catch block. It will rollback on any error
$sqlite->transBegin();
$id = $db->insert('users', ['name' => 'Codethereal', 'email' => 'info@codethereal.com']);
$db->insert('postss', ['name' => 'New post', 'user_id' => $id]);
$sqlite->transCommit();
```

###  Health Score

31

—

LowBetter than 68% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity19

Limited adoption so far

Community11

Small or concentrated contributor base

Maturity63

Established project with proven stability

 Bus Factor1

Top contributor holds 97.4% 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 ~59 days

Recently: every ~89 days

Total

7

Last Release

1655d ago

Major Versions

v1.5.0 → v2.0.02021-10-26

PHP version history (2 changes)v1.1.0PHP &gt;=7.4

v2.0.0PHP ^8.0

### Community

Maintainers

![](https://www.gravatar.com/avatar/8e760ba7457f28ad0cc26d928dc634802a18d7c8a75efbc1daf110e1659464e3?d=identicon)[doguakkaya](/maintainers/doguakkaya)

---

Top Contributors

[![dogukanakkaya](https://avatars.githubusercontent.com/u/51231605?v=4)](https://github.com/dogukanakkaya "dogukanakkaya (37 commits)")[![Rollylni](https://avatars.githubusercontent.com/u/62455812?v=4)](https://github.com/Rollylni "Rollylni (1 commits)")

---

Tags

phpdatabasequery builder

### Embed Badge

![Health badge](/badges/codethereal-sqlite-php/health.svg)

```
[![Health](https://phpackages.com/badges/codethereal-sqlite-php/health.svg)](https://phpackages.com/packages/codethereal-sqlite-php)
```

###  Alternatives

[lulco/phoenix

Database Migrations for PHP

180329.4k4](/packages/lulco-phoenix)[wayofdev/laravel-cycle-orm-adapter

🔥 A Laravel adapter for CycleORM, providing seamless integration of the Cycle DataMapper ORM for advanced database handling and object mapping in PHP applications.

3516.7k3](/packages/wayofdev-laravel-cycle-orm-adapter)[soosyze/queryflatfile

The Queryflatfile is PHP library for simple database not SQL

181.0k1](/packages/soosyze-queryflatfile)

PHPackages © 2026

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