PHPackages                             soosyze/queryflatfile - 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. soosyze/queryflatfile

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

soosyze/queryflatfile
=====================

The Queryflatfile is PHP library for simple database not SQL

3.1.0(3y ago)181.1k1MITPHPPHP &gt;=7.2CI failing

Since Jun 11Pushed 2y ago3 watchersCompare

[ Source](https://github.com/soosyze/queryflatfile)[ Packagist](https://packagist.org/packages/soosyze/queryflatfile)[ RSS](/packages/soosyze-queryflatfile/feed)WikiDiscussions main Synced today

READMEChangelog (10)Dependencies (5)Versions (26)Used By (1)

Queryflatfile
=============

[](#queryflatfile)

[![Build Status](https://github.com/soosyze/queryflatfile/workflows/Tests/badge.svg?branch=master)](https://github.com/soosyze/queryflatfile/actions?query=branch:master "Tests")[![Coverage Status](https://camo.githubusercontent.com/6706ff2f3230822165e56aa9a7ce3fc9efb84bde6b9aa252d5f7799411e76aee/68747470733a2f2f636f766572616c6c732e696f2f7265706f732f6769746875622f736f6f73797a652f7175657279666c617466696c652f62616467652e7376673f6272616e63683d6d6173746572)](https://coveralls.io/github/soosyze/queryflatfile?branch=master "Coveralls")[![GitHub](https://camo.githubusercontent.com/850eae1099d2b05f53383473d7cd51f9bc1ab09b7d0d9e5122f1dd930efdcc6d/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c6963656e73652f6d6173686170652f6170697374617475732e737667)](https://github.com/soosyze/queryflatfile/blob/master/LICENSE "LICENSE")[![Packagist](https://camo.githubusercontent.com/945f78d9242b80db99adfc7b696b6bff2062779ed10287374a85ff8124315933/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f736f6f73797a652f7175657279666c617466696c652e737667)](https://packagist.org/packages/soosyze/queryflatfile "Packagist")[![PHP from Packagist](https://camo.githubusercontent.com/6145d2df4d5157a8c1e195b84afef4095585384b87bad81f62c392a04d946f69/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f7068702d762f736f6f73797a652f7175657279666c617466696c652e737667)](/README.md#version-php "PHP version 7.2 minimum")[![GitHub code size in bytes](https://camo.githubusercontent.com/ad166c25fe0dc15acd9e1662be0f8ad02150b0addeee21697cfdada93e92f090/68747470733a2f2f696d672e736869656c64732e696f2f6769746875622f6c616e6775616765732f636f64652d73697a652f736f6f73797a652f7175657279666c617466696c652e737667)](https://github.com/soosyze/queryflatfile/archive/master.zip "Download")

- 🇬🇧 [README in English](README.md)
- 🇫🇷 [README en Français](README_fr.md)

About
-----

[](#about)

Queryflatfile is a flat file database library written in PHP. Stores your data by default in `JSON` format, also supports `txt`, [msgPack](https://pecl.php.net/package/msgpack) and [igbinary](https://pecl.php.net/package/igbinary) formats. Manipulate your data with a QueryBuilder similar to SQL syntax.

Summary
-------

[](#summary)

- [Requirements](/README.md#requirements)
- [Installation](/README.md#installation)
- [Simple example](/README.md#simple-exemple)
- [Methods](/README.md#methods)
- [Usage](/README.md#usage)
- [License](/README.md#license)

Requirements
------------

[](#requirements)

### PHP version

[](#php-version)

Version PHPQueryFlatFile 3.1.x&lt;= 7.1✗ Unsupported7.2 / 7.3 / 7.4✓ Supported8.0 / 8.1 / 8.2✓ Supported### Extensions

[](#extensions)

- `txt` for recording data with PHP serialize,
- `json` for recording data in JSON format,
- [msgPack](https://pecl.php.net/package/msgpack) for recording data in binary.
- [igbinary](https://pecl.php.net/package/igbinary) for recording data in binary.

### Memory required

[](#memory-required)

The minimum amount of memory required depends on the amount of data you are going to process and the type of operations.

### Permission of files and directory

[](#permission-of-files-and-directory)

Permission to write and read files in the directory that will store your data.

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

[](#installation)

### Composer

[](#composer)

To install **Queryflatfile** via Composer you must have the installer or the binary file [Composer](https://getcomposer.org/download/)

Go to your project directory, open a command prompt and run the following command:

```
composer require soosyze/queryflatfile --no-dev
```

Or, if you use the binary file,

```
php composer.phar require soosyze/queryflatfile --no-dev
```

Simple example
--------------

[](#simple-example)

```
require __DIR__ . '/vendor/autoload.php';

use Soosyze\Queryflatfile\Schema;
use Soosyze\Queryflatfile\Request;
use Soosyze\Queryflatfile\TableBuilder;
use Soosyze\Queryflatfile\Driver\Json;

$sch = new Schema(__DIR__ . 'data', 'schema', new Json());
$req = new Request($sch);

$sch->createTableIfNotExists('user', function(TableBuilder $table): void {
    $table->increments('id')
    $table->string('name')
    $table->string('firstname')->nullable();
});

$req->insertInto('user', [ 'name', 'firstname' ])
    ->values([ 'NOEL', 'Mathieu' ])
    ->values([ 'DUPOND', 'Jean' ])
    ->values([ 'MARTIN', null ])
    ->execute();

$data = $req->select('id', 'name')
    ->from('user')
    ->where('firstname', '=', 'Jean')
    ->fetch();

print_r($data);

$sch->dropTableIfExists('user');
```

The above example will output:

```
Array
(
    [id] => 2
    [name] => DUPOND
)

```

Methods
-------

[](#methods)

**Schema**

- `dropSchema()`,
- `getIncrement( string $tableName )`,
- `getSchema()`,
- `getTableSchema( string $tableName )`,
- `hasColumn( string $tableName, $columnName )`,
- `hasTable( string $tableName )`,
- `setConfig( string $host, string $name = 'schema', DriverInterface $driver = null )`.

**Handling tables**

- `alterTable( string $tableName, callable $callback )`,
- `createTable( string $tableName, callable $callback = null )`,
- `createTableIfNotExists( string $tableName, callable $callback = null )` :
    - `boolean( string $name )`,
    - `char( string $name, $length = 1)`,
    - `date( string $name )`,
    - `dateTime( string $name )`,
    - `float( string $name )`,
    - `increments( string $name )`,
    - `integer( string $name )`,
    - `string( string $name, $length = 255)`,
    - `text( string $name )`.
- `dropTable( string $tableName )`,
- `dropTableIfExists( string $tableName )`,
- `truncateTable( string $tableName )`.

**Selection request**

- `select( string ...$columnNames )`,
- `from( string $tableName )`,
- `leftJoin( string $tableName, \Closure|string $column, string $condition = '', string $value = '' )`,
- `rightJoin( string $tableName, \Closure|string $column, string $condition = '', string $value = '' )`,
- `union( RequestInterface $union )`,
- `unionAll( RequestInterface $union )`,
- `orderBy( string $columnName, int $order = SORT_DESC|SORT_ASC )`,
- `limit( int $limit, int $offset = 0 )`.

**Request for execution**

- `insertInto( string $tableName, array $columnNames )`,
- `values( array $rowValues )`,
- `update( string $tableName, array $row )`,
- `delete()`,
- `execute()` Performs the insertion, modification and deletion of data.

**Result(s) of the query**

- `fetch(): array` Returns the first result of the query,
- `fetchAll(): array` Returns all the results of the query,
- `lists( string $columnName, string $key = null ): array` Returns a list of the column passed in parameter.

**Where**

- `where( string $columnName, string $condition, null|scalar $value )`,
- `orWhere( string $columnName, string $condition, null|scalar $value )`,
- `notWhere( string $columnName, string $condition, null|scalar $value )`,
- `orNotWhere( string $columnName, string $condition, null|scalar $value )`.

Supported conditions (===, ==, !=, &lt;&gt;, &lt;, &lt;=, &gt;, &gt;=, like, ilike, not like, not ilike)

**Where**

- `whereGroup( \Closure $columnName )`,
- `orWhereGroup( \Closure $columnName )`,
- `notWhereGroup( \Closure $columnName )`,
- `orNotWhereGroup( \Closure $columnName )`.

**Where between**

- `between( string $columnName, $min, $max )`,
- `orBetween( string $columnName, $min, $max )`,
- `notBetween( string $columnName, $min, $max )`,
- `orNotBetween( string $columnName, $min, $max )`.

**Where in**

- `in( string $columnName, array $values )`,
- `orIn( string $columnName, array $values )`,
- `notIn( string $columnName, array $values )`,
- `orNotIn( string $columnName, array $values )`.

**Where isNull**

- `isNull( string $columnName )`,
- `orIsNull( string $columnName )`,
- `isNotNull( string $columnName )`,
- `orIsNotNull( string $columnName )`.

**Where regex**

- `regex( string $columnName, string $pattern )`,
- `orRegex( string $columnName, string $pattern )`,
- `notRegex( string $columnName, string $pattern )`,
- `orNotRegex( string $columnName, string $pattern )`.

Usage
-----

[](#usage)

For examples of uses, refer to the [user documentation](/USAGE.md).

License
-------

[](#license)

This project is licensed under the [MIT license](/LICENSE).

###  Health Score

34

—

LowBetter than 75% of packages

Maintenance20

Infrequent updates — may be unmaintained

Popularity24

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity68

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

Recently: every ~0 days

Total

24

Last Release

1297d ago

Major Versions

1.4.1 → 2.0.02022-12-11

2.0.0 → 3.0.02022-12-11

PHP version history (3 changes)1.0.0PHP &gt;=5.4

1.0.1PHP &gt;=5.3

2.0.0PHP &gt;=7.2

### Community

Maintainers

![](https://www.gravatar.com/avatar/5e895b534ebcc8bd54a08b36cad6507da36117a7146b88e62ad53fa45c96c362?d=identicon)[noelma](/maintainers/noelma)

---

Top Contributors

[![mathieu-noel](https://avatars.githubusercontent.com/u/200080698?v=4)](https://github.com/mathieu-noel "mathieu-noel (148 commits)")

---

Tags

composerdatabasedbflat-filelibrarynosqlphpphp-libraryquery-builderphpcomposerdatabaselibrarynosqldbquery builderPHP Libraryflat filedb flat file

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan, Rector

Type Coverage Yes

### Embed Badge

![Health badge](/badges/soosyze-queryflatfile/health.svg)

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

###  Alternatives

[stefangabos/zebra_database

An advanced, compact and lightweight MySQL database wrapper library, built around PHP's MySQLi extension.

11712.4k](/packages/stefangabos-zebra-database)[cubettech/lacassa

Cassandra based query builder for laravel.

348.6k](/packages/cubettech-lacassa)

PHPackages © 2026

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