PHPackages                             jelix/database - 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. jelix/database

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

jelix/database
==============

Lightweight PHP abstraction layer to access and query SQL databases, with an API to inspect and modify databases schema.

v1.4.1(2mo ago)03.6k↓45.8%21LGPL-2.1PHPPHP ^7.4.0 || ^8.0CI failing

Since Mar 3Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/jelix/JelixDatabase)[ Packagist](https://packagist.org/packages/jelix/database)[ Docs](https://jelix.org)[ RSS](/packages/jelix-database/feed)WikiDiscussions master Synced 2w ago

READMEChangelogDependencies (4)Versions (18)Used By (1)

Lightweight PHP abstraction layer to access and query SQL databases.

It uses the dedicated PHP API for each database type it supports, not PDO. The API of connectors and result sets are almost the same as in PDO. There is an API to manipulate schemas.

It supports Mysql 8+, Postgresql 13+, Sqlite 3. It supports partially (Schema API not fully implemented) SQLServer 2012+ and OCI. There is a connector using PDO, so you can use other databases (except with the Schema API).

Compatible with PHP 8.2 to 8.5.

installation
============

[](#installation)

You can install it from Composer. In your project:

```
composer require "jelix/database"

```

Usage
=====

[](#usage)

Quick start:

```
use \Jelix\Database\AccessParameters;
use \Jelix\Database\Connection;

// parameters to access to a database. they can come from a configuration file or else..
$parameters = array(
  'driver'=>'sqlite3',
  "database"=>"/app/tests/units/tests.sqlite3",
);

// verify content of parameters and prepare them for the Connection object.
$accessParameters = new AccessParameters($parameters, array('charset'=>'UTF-8'));

// then you can retrieve a connector
$db = Connection::create($accessParameters);

// let's insert some values
$insertSql = "INSERT INTO ".$db->encloseName('myValues')." (
     ".$db->encloseName('id'). ",
     ".$db->encloseName('value')."
      ) VALUES ";

$value = 'foo';

// insert one value with a classical query
$db->exec($insertSql." (1, ".$db->quote($value).")");

// insert one value with a prepared query
$stmt = $db->prepare($insertSql."(:id, :val)");
$stmt->bindValue('id', 2, \PDO::PARAM_INT);
$myVar = 'bar';
$stmt->bindParam('value', $myVar, \PDO::PARAM_STR);
$stmt->execute();

// retrieve all records
$resultSet = $db->query("SELECT id, value FROM myValues");

// records are always objects
foreach ($resultSet as $record) {
    echo "id=".$record->id."\n";
    echo "value=".$record->value."\n";
}
```

Full documentation: see the [docs](docs/en/index.md) directory.

History
-------

[](#history)

This library has been extracted from the [Jelix](https://jelix.org) framework 1.7, and it has been modernized.

###  Health Score

52

—

FairBetter than 96% of packages

Maintenance86

Actively maintained with recent releases

Popularity23

Limited adoption so far

Community18

Small or concentrated contributor base

Maturity70

Established project with proven stability

 Bus Factor1

Top contributor holds 96.9% 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 ~139 days

Recently: every ~74 days

Total

17

Last Release

67d ago

Major Versions

v0.1.0 → v1.0.02020-08-03

PHP version history (2 changes)v0.1.0PHP &gt;=7.2

v1.4.0PHP ^7.4.0 || ^8.0

### Community

Maintainers

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

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

---

Top Contributors

[![laurentj](https://avatars.githubusercontent.com/u/336034?v=4)](https://github.com/laurentj "laurentj (156 commits)")[![mind84](https://avatars.githubusercontent.com/u/20710470?v=4)](https://github.com/mind84 "mind84 (2 commits)")[![nworr](https://avatars.githubusercontent.com/u/43475951?v=4)](https://github.com/nworr "nworr (2 commits)")[![lejoko](https://avatars.githubusercontent.com/u/983680?v=4)](https://github.com/lejoko "lejoko (1 commits)")

---

Tags

schemadatabasemysqlpostgresqlsqlsqlserverociabstract layer

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/jelix-database/health.svg)

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

###  Alternatives

[doctrine/dbal

Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.

9.7k595.8M6.5k](/packages/doctrine-dbal)[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4563.1M37](/packages/aura-sqlquery)[cycle/database

DBAL, schema introspection, migration and pagination

65746.2k48](/packages/cycle-database)[ezsql/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86848.3k](/packages/ezsql-ezsql)[aura/sqlschema

Provides facilities to read table names and table columns from a database using PDO.

41240.2k4](/packages/aura-sqlschema)[jv2222/ezsql

Advance database access library. Make interacting with a database ridiculously easy. An universal interchangeable CRUD system.

86811.4k2](/packages/jv2222-ezsql)

PHPackages © 2026

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