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

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

jetea/database
==============

The Jetea Database component.

2.0.0(7y ago)2511MITPHPPHP &gt;=7.1.3

Since Jan 23Pushed 7y ago1 watchersCompare

[ Source](https://github.com/Jetea/database)[ Packagist](https://packagist.org/packages/jetea/database)[ RSS](/packages/jetea-database/feed)WikiDiscussions master Synced 2d ago

READMEChangelogDependencies (1)Versions (2)Used By (1)

database
========

[](#database)

The Jetea Database component.

The following database vendors are currently supported:

- MySQL
- PostgreSQL

Overview
--------

[](#overview)

- [Installation](#installation)
- [Usage](#usage)
    - [get connection](#get-connection)
    - [insert and get insert id](#insert-and-get-insert-id)
    - [insert and get the number of rows affected](#insert-and-get-the-number-of-rows-affected)
    - [update and get the number of rows affected](#update-and-get-the-number-of-rows-affected)
    - [select](#select)
    - [delete and get the number of rows affected](#delete-and-get-the-number-of-rows-affected)
    - [transaction](#transaction)
    - [get query logs](#get-query-logs)
    - [execute the given callback in "dry run"(空转) mode](#execute-the-given-callback-in-dry-run%E7%A9%BA%E8%BD%AC-mode)
- [License](#license)

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

[](#installation)

```
composer require jetea/database=~2.0 -vvv

```

Usage
-----

[](#usage)

### get connection

[](#get-connection)

- MySql

```
$dsn = sprintf('mysql:host=%s;port=%s;dbname=%s;charset=%s', '127.0.0.1', 3306, 'es_demo', 'utf8mb4');
$conn = new MySqlConnection($dsn, 'root', 123123);

```

- Postgres

```
$dsn = sprintf('pgsql:host=%s;port=%s;dbname=%s', '127.0.0.1', 3306, 'es_demo');
$conn = new PostgresConnection($dsn, 'root', 123123);

```

### insert and get insert id

[](#insert-and-get-insert-id)

```
$insertId = $conn->table('profile')->insertGetId([
    'name'      => 'test-name',
    'gender'    => 1,
    'birthday'  => '1988-12-01 01:00:01', //DATETIME
    'memo'      => 'this is a test memo',
    'lat'       => '30.54916000', //DECIMAL(10,8)
    'lng'       => '104.06761000' //DECIMAL(11,8)
]);

```

### insert and get the number of rows affected

[](#insert-and-get-the-number-of-rows-affected)

```
$affectNum = $conn->table('profile')->insert([
    [
        'name'      => 'test-name',
        'gender'    => 1,
        'birthday'  => '1988-12-01 01:00:01',
        'memo'      => 'this is a test memo',
        'lat'       => '30.54916000',
        'lng'       => '104.06761000'
    ],
    [
        'name'      => 'test-name-1',
        'gender'    => 1,
        'birthday'  => '2010-12-01 01:00:01',
        'memo'      => 'this is another test memo',
        'lat'       => '30.54916000',
        'lng'       => '104.06761000'
    ],
]);

```

### update and get the number of rows affected

[](#update-and-get-the-number-of-rows-affected)

```
affectNum = $conn->update('update profile set name = :name, memo = :memo where id = :id', [
    ':name'     => 'test-name',
    ':memo'     => 'this is another memo',
    ':id'       => $id,
]);

```

### select

[](#select)

```
$records = $conn->select('select * from profile where id = :id', [
    ':id'   => $id,
]);

```

### delete and get the number of rows affected

[](#delete-and-get-the-number-of-rows-affected)

```
$affectNum = $conn->delete('delete from profile where id = :id', [
    ':id'       => $id,
]);

```

### transaction

[](#transaction)

```
$conn->transaction(function ($conn) {
    //do something...
});

```

### get query logs

[](#get-query-logs)

```
$queryLogs = $conn->getQueryLog();

```

### execute the given callback in "dry run"(空转) mode

[](#execute-the-given-callback-in-dry-run空转-mode)

```
$conn->pretend(function ($conn) {
    //do something...
});

```

License
-------

[](#license)

[MIT](https://opensource.org/licenses/MIT)

###  Health Score

26

—

LowBetter than 43% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity12

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity55

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

Unknown

Total

1

Last Release

2668d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/2c0f113b8e3c23614f2ea5d0feb305fc8ac7db12844630d88125958ea43e757b?d=identicon)[sh7ning](/maintainers/sh7ning)

---

Top Contributors

[![sh7ning](https://avatars.githubusercontent.com/u/4698385?v=4)](https://github.com/sh7ning "sh7ning (12 commits)")

---

Tags

databasejetea

###  Code Quality

TestsPHPUnit

### Embed Badge

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

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

###  Alternatives

[doctrine/dbal

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

9.7k578.4M5.6k](/packages/doctrine-dbal)[doctrine/orm

Object-Relational-Mapper for PHP

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

Symfony DoctrineBundle

4.8k241.3M3.3k](/packages/doctrine-doctrine-bundle)[doctrine/migrations

PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.

4.8k204.8M440](/packages/doctrine-migrations)[doctrine/data-fixtures

Data Fixtures for all Doctrine Object Managers

2.9k136.1M516](/packages/doctrine-data-fixtures)[robmorgan/phinx

Phinx makes it ridiculously easy to manage the database migrations for your PHP app.

4.5k46.2M405](/packages/robmorgan-phinx)

PHPackages © 2026

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