PHPackages                             mgx/slimdb - 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. mgx/slimdb

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

mgx/slimdb
==========

Hafif PDO tabanlı veritabanı bağlantı,migration kütüphanesi

v1.0.1(11mo ago)09PHPPHP &gt;=7.4

Since Jul 29Pushed 10mo agoCompare

[ Source](https://github.com/Mustafa-Senturk/mgx-slimdb)[ Packagist](https://packagist.org/packages/mgx/slimdb)[ RSS](/packages/mgx-slimdb/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (3)Used By (0)

MGX SlimDB
==========

[](#mgx-slimdb)

Hafif, sade ve modern bir PDO tabanlı PHP veritabanı, migration ve seeder kütüphanesi.

---

Özellikler
----------

[](#özellikler)

- PDO ile kolay ve güvenli veritabanı bağlantısı
- Migration desteği (tablo oluşturma, değiştirme, silme)
- Seeder desteği (örnek veri ekleme)
- QueryBuilder ile kolay SQL sorguları
- CLI ile migration ve seeder yönetimi
- PSR-4 uyumlu modern yapı

---

Kurulum
-------

[](#kurulum)

### Composer ile Kurulum

[](#composer-ile-kurulum)

```
composer require mgx/slimdb
```

> **Not:** Henüz Packagist’e yüklemediyseniz, kendi projenizde local olarak kullanmak için:
>
> 1. Ana projenizin `composer.json` dosyasına aşağıdaki satırı ekleyin: ```
>     "repositories": [
>         {
>             "type": "path",
>             "url": "../mgx-slimdb"
>         }
>     ]
>     ```
> 2. Sonra: ```
>     composer require mgx/slimdb:dev-main
>     ```

---

Temel Kullanım
--------------

[](#temel-kullanım)

### 1. Veritabanı Bağlantısı

[](#1-veritabanı-bağlantısı)

```
use Mgx\Slimdb\Connect;

$config = [
    'host'     => 'localhost',
    'dbname'   => 'test_db',
    'username' => 'root',
    'password' => '',
];

$db = Connect::getInstance($config);
```

---

### 2. Migration Kullanımı

[](#2-migration-kullanımı)

#### Migration Oluşturma

[](#migration-oluşturma)

```
use Mgx\Slimdb\Migration\Migration;
use Mgx\Slimdb\TableBlueprint;

class CreateUsersTable extends Migration
{
    public function up()
    {
        $this->create('users', function (TableBlueprint $table) {
            $table->id();
            $table->string('name', 100);
            $table->string('email')->unique();
            $table->string('password', 60);
            $table->timestamps();
        });
    }

    public function down()
    {
        $this->drop('users');
    }
}
```

#### Migration Çalıştırma (CLI)

[](#migration-çalıştırma-cli)

```
php ornekler/Migration_Runner_ornek.php
```

---

### 3. Seeder Kullanımı

[](#3-seeder-kullanımı)

#### Seeder Sınıfı

[](#seeder-sınıfı)

```
use Mgx\Slimdb\Seeder;

class UsersSeeder extends Seeder
{
    public function run(): void
    {
        $this->seedTable('users', [
            [
                'name' => 'Admin',
                'email' => 'admin@example.com',
                'password' => password_hash('123456', PASSWORD_DEFAULT)
            ]
        ]);
    }
}
```

#### Tüm Seeder'ları Çalıştırmak

[](#tüm-seederları-çalıştırmak)

```
php ornekler/DatabaseSeeder.php
```

---

### 4. QueryBuilder Kullanımı

[](#4-querybuilder-kullanımı)

```
use Mgx\Slimdb\QueryBuilder;

$qb = new QueryBuilder($db);

// Tüm kullanıcıları çek
$users = $qb->table('users')->select()->get();

// Filtreli sorgu
$admins = $qb->table('users')->where('email', 'LIKE', '%admin%')->get();
```

---

CLI ile Migration ve Seeder Yönetimi
------------------------------------

[](#cli-ile-migration-ve-seeder-yönetimi)

Hazır CLI dosyası ile migration ve seeder işlemlerini kolayca yönetebilirsiniz:

```
php ornekler/ornekcli.php migrate      # Tüm migration'ları çalıştırır
php ornekler/ornekcli.php rollback     # Son migration'ı geri alır
php ornekler/ornekcli.php status       # Migration durumunu gösterir
php ornekler/ornekcli.php new    # Yeni migration dosyası oluşturur
```

---

Klasör Yapısı
-------------

[](#klasör-yapısı)

```
mgx-slimdb/
├── src/                # Ana kütüphane kodları
├── ornekler/           # Kullanım örnekleri ve CLI dosyaları
├── test/               # Otomatik testler
├── migrations/         # Migration dosyaları (kendi projenizde)
├── seeds/              # Seeder dosyaları (kendi projenizde)
├── composer.json
└── README.md

```

---

Test
----

[](#test)

```
composer install
vendor/bin/phpunit
```

---

Katkı ve Lisans
---------------

[](#katkı-ve-lisans)

- Katkı yapmak için PR gönderebilirsiniz.
- MIT Lisansı ile dağıtılmaktadır.

---

\*\*Daha fazla örnek ve detay

###  Health Score

27

—

LowBetter than 47% of packages

Maintenance52

Moderate activity, may be stable

Popularity4

Limited adoption so far

Community6

Small or concentrated contributor base

Maturity38

Early-stage or recently created project

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

Total

2

Last Release

339d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/31421506?v=4)[mustafa şentürk](/maintainers/Mustafa-Senturk)[@Mustafa-Senturk](https://github.com/Mustafa-Senturk)

---

Top Contributors

[![Mustafa-Senturk](https://avatars.githubusercontent.com/u/31421506?v=4)](https://github.com/Mustafa-Senturk "Mustafa-Senturk (10 commits)")

---

Tags

dbpdopdo-phpslimphpmiddlewaredatabasepdoPSR-4mgx

### Embed Badge

![Health badge](/badges/mgx-slimdb/health.svg)

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

###  Alternatives

[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[popphp/pop-db

Pop Db Component for Pop PHP Framework

1816.5k12](/packages/popphp-pop-db)[riverside/php-orm

PHP ORM micro-library and query builder

121.3k](/packages/riverside-php-orm)

PHPackages © 2026

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