PHPackages                             lambdacasserole/condense - 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. lambdacasserole/condense

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

lambdacasserole/condense
========================

Flat-file database in PHP.

v1.2(8y ago)21362MITPHP

Since Jan 24Pushed 8y ago3 watchersCompare

[ Source](https://github.com/lambdacasserole/condense)[ Packagist](https://packagist.org/packages/lambdacasserole/condense)[ RSS](/packages/lambdacasserole-condense/feed)WikiDiscussions master Synced today

READMEChangelog (3)Dependencies (1)Versions (5)Used By (0)

Condense
========

[](#condense)

Flat-file database in PHP.

[![Logo](logo.png)](logo.png)

Based on the [Fllat](https://github.com/wylst/fllat) and [Prequel](https://github.com/wylst/prequel) libraries by [Wylst](https://github.com/wylst). Special mention for [Alfred Xing](https://github.com/alfredxing) who seems to be the main contributor behind both. With added support for:

- Encrypted databases using [php-encryption](https://github.com/defuse/php-encryption) by [Taylor Hornby](https://github.com/defuse)
- Composer via Packagist

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

[](#installation)

Install Condense via Composer like this:

```
composer require lambdacasserole/condense
```

Or alternatively, if you're using the PHAR (make sure the `php.exe` executable is in your PATH):

```
php composer.phar require lambdacasserole/condense

```

Usage
-----

[](#usage)

To initialize a new database or load an existing one, do this.

```
$db = new Database('employees');
```

This will, by default, create a file `db/employees.dat` or load that file, if it already exists. You can change the path at which the flat file database will be created thusly.

```
$db = new Database('employees', '../storage');
```

The constructor also accepts a third parameter which allows you to specify a key to use to encrypt the database with.

```
$db = new Database('secrets', '../private', 'my-secret-password');
```

When loading the database again, this same password must be used.

### Create

[](#create)

Use `insert` to add a record (row) to the database.

```
$hire = ['first_name' => 'Ethan', 'last_name' => 'Benson', 'salary' => 20000];
$employees->insert($hire);
```

### Retrieve

[](#retrieve)

Condense provides several methods for data retrieval.

#### One Value

[](#one-value)

Use the `get` method. Specify a field name, another field name, and a value. It will return the value of the first field where (in the same row), the value of the second field matches the given value.

```
// Returns the salary of the first employee with the first name 'Ethan' (20000).
$employees->get('salary', 'first_name', 'Ethan');
```

#### Field Subset

[](#field-subset)

Use the `select` method. Returns some (or all) fields in a table, specified by giving an array of desired field names.

```
// Returns the whole database.
$employees->select([]);

// Returns the first name of each employee, for example:
// [['Ethan'],['Thomas'],['James']]
$employees->select(['first_name']);
```

### Update

[](#update)

Condense provides a couple of methods for updating existing data in a database.

#### One Field

[](#one-field)

Use the `to` method to update one field for any row satisfying a condition.

```
// Change every employee with a first name 'Ethan' to have the surname 'Smithers'.
$employees->to('last_name', 'Smithers', 'first_name', 'Ethan');
```

#### One Row

[](#one-row)

Use the `update` method to update a row by index.

```
// Change the first row in the database completely.
$employees->update(0, ['first_name' => 'Alison', 'last_name' => 'Bradberry']);
```

### Delete

[](#delete)

Use the `remove` method to delete a row in the database.

```
// Remove the first row in the database.
$employees->remove(0);
```

Caveats
-------

[](#caveats)

This is a flat file database system. It removes the headache of setting up and configuring a database server, but introduces a few of its own:

- I/O will be *much* slower due to many disk read/write actions
- Encrypting a database will hugely affect performance
- Bugs may arise due to concurrency issues
- Misconfigured web applications using this library may accidentally allow their databases to be downloaded over HTTP

###  Health Score

31

—

LowBetter than 66% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity15

Limited adoption so far

Community12

Small or concentrated contributor base

Maturity66

Established project with proven stability

 Bus Factor1

Top contributor holds 94.7% 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 ~107 days

Total

3

Last Release

3229d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/5577382?v=4)[Saul Johnson](/maintainers/lambdacasserole)[@lambdacasserole](https://github.com/lambdacasserole)

---

Top Contributors

[![lambdacasserole](https://avatars.githubusercontent.com/u/5577382?v=4)](https://github.com/lambdacasserole "lambdacasserole (18 commits)")[![aeromaxx](https://avatars.githubusercontent.com/u/6503475?v=4)](https://github.com/aeromaxx "aeromaxx (1 commits)")

---

Tags

composerdatabaseflat-filepackagistphp

### Embed Badge

![Health badge](/badges/lambdacasserole-condense/health.svg)

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

###  Alternatives

[jdorn/sql-formatter

a PHP SQL highlighting library

3.9k116.5M113](/packages/jdorn-sql-formatter)[pimcore/pimcore

Content &amp; Product Management Framework (CMS/PIM/E-Commerce)

3.8k3.8M465](/packages/pimcore-pimcore)[prestashop/prestashop

PrestaShop is an Open Source e-commerce platform, committed to providing the best shopping cart experience for both merchants and customers.

9.1k16.8k](/packages/prestashop-prestashop)[propel/propel1

Propel is an open-source Object-Relational Mapping (ORM) for PHP5.

8351.6M87](/packages/propel-propel1)[open-dxp/opendxp

Content &amp; Product Management Framework (CMS/PIM)

9417.2k58](/packages/open-dxp-opendxp)[jelix/jelix

Jelix PHP framework

84109.7k5](/packages/jelix-jelix)

PHPackages © 2026

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