PHPackages                             ggedde/spry-db - 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. ggedde/spry-db

ActiveSpry-provider[Database &amp; ORM](/categories/database)

ggedde/spry-db
==============

Database Provider for Spry

1.0.12(4y ago)01451MITPHPPHP &gt;=5.4.0

Since Jul 11Pushed 4y ago1 watchersCompare

[ Source](https://github.com/ggedde/spry-db)[ Packagist](https://packagist.org/packages/ggedde/spry-db)[ RSS](/packages/ggedde-spry-db/feed)WikiDiscussions master Synced yesterday

READMEChangelogDependencies (1)Versions (45)Used By (1)

spry-db
=======

[](#spry-db)

Default Database Class for Spry

Spry's default Provider uses "Medoo" and you can find all the Documentation here:

Example Usage:

```
$item = Spry::db()->get('items', '*', ['id' => 123]);

$items = Spry::db()->select('items', '*', ['date[>]' => '2020-01-01']);

$insertResponse = Spry::db()->insert('items', ['name' => 'test', 'date' => '2020-01-01']);

$updateResponse = Spry::db()->update('items', ['name' => 'newtest'], ['id' => 123]);

$deleteResponse = Spry::db()->delete('items', ['id' => 123]);
```

[See Full Documentation](https://medoo.in/doc)

Spry Config Settings
--------------------

[](#spry-config-settings)

```
$config->dbProvider = 'Spry\\SpryProvider\\SpryDB';
$config->db = [
    'database_type' => 'mysql',
    'database_name' => '',
    'server' => 'localhost',
    'username' => '',
    'password' => '',
    'charset' => 'utf8',
    'port' => 3306,
    'prefix' => 'api_x_', // Should change this to be someting Unique
    'schema' => [
        'tables' => [
            'users' => [
                'columns' => [
                    'name' => [
                        'type' => 'string'
                    ],
                    'email' => [
                        'type' => 'string'
                    ],
                ]
            ]
        ]
    ]
];
```

Schema
------

[](#schema)

You can use this to build out or Modify your Database Schema.

Using Spry CLI your can run

```
spry migrate
spry migrate --dryrun     (Show what changes will be made without running anything)
spry migrate --force      (Run Destructively. Will delete and change fields. You could loose precious data)

```

Scheme Settings

```
'schema' => [
    'tables' => [
        'users' => [
            'columns' => [
                'name' => [
                    'type' => 'string'
                ],
                'email' => [
                    'type' => 'string',
                    'unique' => true
                ],
                'amount' => [
                    'type' => 'number',
                    'default' => 0
                ],
                'status' => [
                    'type' => 'enum',
                    'options' => ['pending','active','completed','archived',''],
                ],
                'start_date' => [
                    'type' => 'datetime',
                    'default' => 'CURRENT_TIMESTAMP'
                ],
            ]
        ]
    ]
]
```

### Various Column Types

[](#various-column-types)

```
- bigint             BIGINT   21
- bigstring          VARCHAR  255
- bigtext            LONGTEXT
- bool               TINYINT  1
- date               DATE
- datetime           DATETIME
- decimal            DECIMAL  10,2
- enum               ENUM
- int                INT      10
- number             FLOAT
- string             VARCHAR  64
- text               TEXT
- time               TIME
- tinyint            TINYINT  3
- tinystring         VARCHAR  10

```

### Default Fields

[](#default-fields)

By default the scheme will create an 'id', 'updated\_at' and 'created\_at' fields.

You can remove these by using 'use\_id' and 'timestamps' in the table schema settings.

```
'schema' => [
    'tables' => [
        'users' => [
            'use_id' => false,
            'timestamps' => false
        ]
    ]
]
```

### Unique Key

[](#unique-key)

You can make any column 'unique' by adding the attribute:

```
'email' => [
    'type' => 'string',
    'unique' => true
]
```

If you need to combine columns then use an array with the additional fields to be included in the unique key

```
'email' => [
    'type' => 'string',
    'unique' => [
        'name',
        'phone'
    ]
]
```

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity10

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity71

Established project with proven stability

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

Recently: every ~183 days

Total

44

Last Release

1525d ago

Major Versions

0.9.29 → 1.0.02020-03-02

### Community

Maintainers

![](https://www.gravatar.com/avatar/459f086623b58e334ff8f569a9cedaf847ff4fef97b1c9aceabb618f9e2006fa?d=identicon)[ggedde](/maintainers/ggedde)

---

Top Contributors

[![ggedde](https://avatars.githubusercontent.com/u/3236909?v=4)](https://github.com/ggedde "ggedde (56 commits)")

### Embed Badge

![Health badge](/badges/ggedde-spry-db/health.svg)

```
[![Health](https://phpackages.com/badges/ggedde-spry-db/health.svg)](https://phpackages.com/packages/ggedde-spry-db)
```

PHPackages © 2026

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