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

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

vista-php/database
==================

Database abstraction layer

1.0.3(1y ago)168MITPHPPHP ^8.3

Since Mar 19Pushed 1y ago1 watchersCompare

[ Source](https://github.com/vista-php/database)[ Packagist](https://packagist.org/packages/vista-php/database)[ RSS](/packages/vista-php-database/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (4)Versions (5)Used By (0)

VISTA PHP Database Module
=========================

[](#vista-php-database-module)

Introduction
------------

[](#introduction)

Vista PHP Database module is a part of Vista PHP Framework, but can also be used as a stand alone ORM (Object Relational Mapper) for PHP. It is designed to simplify database manipulation and provide a secure way to interact with databases.

Getting Started
---------------

[](#getting-started)

### Installation

[](#installation)

```
composer require vista-php/database
```

### Configuration

[](#configuration)

The database configuration should be stored in the `config/database.php` file. The file should return an array with the following keys: `DB_TYPE`, `DB_HOST`, `DB_NAME`, `DB_USER` and `DB_PASS`

#### For SQLite:

[](#for-sqlite)

```
return [
    'DB_TYPE' => 'sqlite',
    'DB_NAME' => __DIR__ . '../database/database.sqlite',
];
```

#### For MySQL:

[](#for-mysql)

```
return [
    'DB_TYPE' => 'mysql',
    'DB_NAME' => 'database',
    'DB_HOST' => 'localhost',
    'DB_USER' => 'root',
    'DB_PASS' => 'root'
];
```

### Usage

[](#usage)

All you need to do is extend the `Vista\Model\Model` class in one of your model class and define the table name, primary key, columns and relationship methods.

#### Example:

[](#example)

```
use Vista\Model\Model;

class User extends Model
{
    protected string $table = 'users';
    protected string $primaryKey = 'id';
    protected array $columns = ['id', 'name', 'username', 'password'];
    protected array $relationships = ['posts']

    public function posts()
    {
        return Post::where('user_id', $this->id);
    }
}
```

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance46

Moderate activity, may be stable

Popularity11

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity56

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

Total

4

Last Release

418d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/24e3df1e6f1f1304c7ba83fbdbb309ee383ca3759d1d19856102e16e0d1177e3?d=identicon)[dusanrajcevic](/maintainers/dusanrajcevic)

---

Top Contributors

[![dusanrajcevic](https://avatars.githubusercontent.com/u/8985071?v=4)](https://github.com/dusanrajcevic "dusanrajcevic (14 commits)")

---

Tags

abstractiondatabaselayer

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

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

```
[![Health](https://phpackages.com/badges/vista-php-database/health.svg)](https://phpackages.com/packages/vista-php-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)[adodb/adodb-php

ADOdb is a PHP database abstraction layer library

4553.9M28](/packages/adodb-adodb-php)[ezsql/ezsql

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

86946.7k](/packages/ezsql-ezsql)[jv2222/ezsql

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

87311.3k2](/packages/jv2222-ezsql)

PHPackages © 2026

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