PHPackages                             badpenguin/flatfiledb - 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. badpenguin/flatfiledb

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

badpenguin/flatfiledb
=====================

PHP Flat File DB API

242111PHP

Since Apr 2Pushed 4y ago3 watchersCompare

[ Source](https://github.com/badpenguin/flatfiledb)[ Packagist](https://packagist.org/packages/badpenguin/flatfiledb)[ RSS](/packages/badpenguin-flatfiledb/feed)WikiDiscussions master Synced 1mo ago

READMEChangelogDependenciesVersions (1)Used By (0)

FlatFileDB
==========

[](#flatfiledb)

PHP Flat File DB library with cache for CMS

More informations are available at

Why?
----

[](#why)

On my VPS i uses Wordpress that is a fatty slow MySQL app.

Faster websites performs better also in SEO ranking.

Technology
----------

[](#technology)

- Don't reinvent the wheel.
- Uses "dba" with "qdbm" format.
- "dba" format can be accessed from Perl and from Bash.

Features
--------

[](#features)

- DBA is a module so its faster then any self-made implementation.
- Table Locking.
- Library has a little "cache" system on top of DBA.
- Can store anything: strings, arrays, objects.

Road Map
--------

[](#road-map)

- Database Locking.
- Disable Locking.
- Implement "composer"

Examples
--------

[](#examples)

### Opening the DB

[](#opening-the-db)

```
$cms = FlatFile::open('db/cms.qdbm');
```

### Write Post

[](#write-post)

```
/* Create an Object */
$post = new stdClass;
$post->id=5;
$post->title='my title';
$post->body='my content';
$post->last_modified_time = time();
$post->tags = array('featured','gallery');

$cms->set($post->id,$post);
if (!$post) die('Save failed');
```

### Get Post

[](#get-post)

```
$post = $cms->get($post_id);
if (!$post) die('Post not found');
```

### Check if Key exists

[](#check-if-key-exists)

```
if ($cms->is_valid('manteinance_mode')) die('Website is under manteinance');
```

### Delete a key

[](#delete-a-key)

```
$cms->delete('manteinance_mode');
```

### Get all data

[](#get-all-data)

```
print_r($cms->get_all());
```

###  Health Score

20

—

LowBetter than 14% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity26

Early-stage or recently created project

 Bus Factor1

Top contributor holds 88.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.

### Community

Maintainers

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

---

Top Contributors

[![badpenguin](https://avatars.githubusercontent.com/u/5000272?v=4)](https://github.com/badpenguin "badpenguin (16 commits)")[![bluehaoran](https://avatars.githubusercontent.com/u/3521663?v=4)](https://github.com/bluehaoran "bluehaoran (2 commits)")

### Embed Badge

![Health badge](/badges/badpenguin-flatfiledb/health.svg)

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

###  Alternatives

[doctrine/orm

Object-Relational-Mapper for PHP

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

a PHP SQL highlighting library

3.9k115.1M102](/packages/jdorn-sql-formatter)[illuminate/database

The Illuminate Database package.

2.8k52.4M9.3k](/packages/illuminate-database)[mongodb/mongodb

MongoDB driver library

1.6k64.0M540](/packages/mongodb-mongodb)[ramsey/uuid-doctrine

Use ramsey/uuid as a Doctrine field type.

90340.3M208](/packages/ramsey-uuid-doctrine)[reliese/laravel

Reliese Components for Laravel Framework code generation.

1.7k3.4M16](/packages/reliese-laravel)

PHPackages © 2026

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