PHPackages                             jacked-php/lite-connect - 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. jacked-php/lite-connect

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

jacked-php/lite-connect
=======================

A SQLite connection pool manager with migrations and model abstraction

0.0.3(1y ago)0551PHPPHP &gt;=8.3

Since Sep 2Pushed 1y ago1 watchersCompare

[ Source](https://github.com/Jacked-PHP/lite-connect)[ Packagist](https://packagist.org/packages/jacked-php/lite-connect)[ GitHub Sponsors](https://github.com/jacked-php)[ RSS](/packages/jacked-php-lite-connect/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (1)Dependencies (2)Versions (4)Used By (1)

LiteConnect
===========

[](#liteconnect)

[![Tests](https://github.com/Jacked-PHP/lite-connect/actions/workflows/php.yml/badge.svg)](https://github.com/Jacked-PHP/lite-connect/actions/workflows/php.yml)

LiteConnect is a simple, lightweight SQLite package for PHP without globals. It is designed to facilitate easy and efficient SQLite database interactions. It is ideal for small to medium-sized projects that require an embedded database solution. This package provides a clean API for managing SQLite connections, running migrations, and interacting with your data models.

Features
--------

[](#features)

- **Connection Management**: Create and manage SQLite connections.
- **Migration Management**: Run migrations to set up your database schema.
- **Model Interaction**: Perform common database operations like `create`, `find`, `update`, `delete`, `where`, and `orderBy` through an intuitive API.

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

[](#installation)

To install LiteConnect, you can require it via Composer:

```
composer require jacked-php/lite-connect
```

Basic Usage
-----------

[](#basic-usage)

### Connecting to a SQLite Database

[](#connecting-to-a-sqlite-database)

```
use JackedPhp\LiteConnect\Connection\Connection;
use JackedPhp\LiteConnect\SQLiteFactory;

/** @var Connection $connection */
$connection = SQLiteFactory::make([
    'database' => 'path/to/your/database.db',
]);

// When you're done with the connection:
$connection->close();
```

### Running Migrations

[](#running-migrations)

To set up your database schema, use the `MigrationManager` to run migrations.

Example with a "users" table migration:

```
use JackedPhp\LiteConnect\Migration\MigrationManager;

class CreateUsersTable implements Migration
{

    public function up(PDO $pdo): void
    {
        $pdo->exec('CREATE TABLE users (
            id INTEGER PRIMARY KEY AUTOINCREMENT,
            name TEXT NULL,
            email TEXT NOT NULL,
            created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
        )');
    }

    public function down(PDO $pdo): void
    {
        $pdo->exec('DROP TABLE users');
    }
}

$migrationManager = new MigrationManager($connection);
$migrationManager->runMigrations([
    new CreateUsersTable(),
]);
```

### Interacting with Models

[](#interacting-with-models)

You can interact with your data using the model classes. Here is an example of a `User` model:

```
use JackedPhp\LiteConnect\Model\BaseModel;

class User extends BaseModel
{
    protected string $table = 'users';

    protected ?string $primaryKey = 'id';

    /**
     * @var string[] $fillable
     */
    protected array $fillable = [
        'name',
        'email',
    ];
}

// Creating a new user
/** @var User $newUser */
$newUser = (new User($connection))->create([
    'name' => 'John Doe',
    'email' => 'john.doe@example.com',
]);

// Finding a user by ID
/** @var User $foundUser */
$foundUser = (new User($connection))->find($newUser->id);

// Updating a user
$foundUser->update([
    'email' => 'john.doe@newdomain.com',
]);

// Deleting a user
$foundUser->delete();
// or
(new User($connection))->where('name', '=', 'John Doe')->delete();
```

### Querying Data

[](#querying-data)

You can use the `where`, `orderBy`, and other query methods to filter and order your data:

```
$users = new User($connection);

$filteredUsers = $users->where('name', '=', 'John Doe')->get();
// or
$orderedUsers = $users->orderBy('id', 'desc')->get();
```

Using a Connection Pool
-----------------------

[](#using-a-connection-pool)

> This example demonstrate how to do so with OpenSwoole - that is not a requirement for this package.

If your project is using `OpenSwoole\Core` package (), here is how you accomplish it:

```
use OpenSwoole\Core\Coroutine\Pool\ClientPool;

$connectionPool = new ClientPool(
    factory: SQLiteFactory::class,
    config: [
        'database' => 'path/to/your/database.db',
    ],
    size: 1,
);

// here you get the connection:
$connection = $connectionPool->get();

// here you put back the connection:
$connectionPool->put($connection);
```

Testing
-------

[](#testing)

You can run tests by running the following after cloning the repository and installing dependencies:

```
vendor/bin/pest
```

Contributing
------------

[](#contributing)

If you would like to contribute to LiteConnect, please feel free to submit pull requests or open issues on the [GitHub repository](https://github.com/Jacked-PHP/lite-connect).

License
-------

[](#license)

LiteConnect is open-sourced software licensed under the [MIT license](LICENSE).

###  Health Score

27

—

LowBetter than 49% of packages

Maintenance37

Infrequent updates — may be unmaintained

Popularity9

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity46

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

Total

3

Last Release

571d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/90c2bdf7a2fb985ab0c72c842c4f7cbff79cb172deb85c06edf0bedceb3c9498?d=identicon)[lotharthesavior](/maintainers/lotharthesavior)

---

Top Contributors

[![lotharthesavior](https://avatars.githubusercontent.com/u/1092909?v=4)](https://github.com/lotharthesavior "lotharthesavior (8 commits)")

---

Tags

phpsqlite

###  Code Quality

TestsPest

### Embed Badge

![Health badge](/badges/jacked-php-lite-connect/health.svg)

```
[![Health](https://phpackages.com/badges/jacked-php-lite-connect/health.svg)](https://phpackages.com/packages/jacked-php-lite-connect)
```

###  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)
