PHPackages                             whizsid/arraybase - 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. whizsid/arraybase

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

whizsid/arraybase
=================

Pure PHP runtime SQL like query language for manipulate php array data.

1.0.1(6y ago)18681[1 issues](https://github.com/whizsid/arraybase/issues)MITPHPPHP ^7.2

Since May 9Pushed 6y ago2 watchersCompare

[ Source](https://github.com/whizsid/arraybase)[ Packagist](https://packagist.org/packages/whizsid/arraybase)[ RSS](/packages/whizsid-arraybase/feed)WikiDiscussions master Synced 4d ago

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

[![](https://camo.githubusercontent.com/a64fffa34bc54f6ffc75462bebcd6a40e2cfee9c6062e9a04b1598238559ca14/68747470733a2f2f692e696d6775722e636f6d2f5a394346674c422e706e67)](https://camo.githubusercontent.com/a64fffa34bc54f6ffc75462bebcd6a40e2cfee9c6062e9a04b1598238559ca14/68747470733a2f2f692e696d6775722e636f6d2f5a394346674c422e706e67)

---

[![License: MIT](https://camo.githubusercontent.com/1a2e0606685ce00663bf829868f794fd3fc9c86f8d80cae324734129e0723a58/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f4c6963656e73652d4d49542d627269676874677265656e2e737667)](https://opensource.org/licenses/MIT)[![Total Downloads](https://camo.githubusercontent.com/3344b5f0cea3f2d01cee1fb97def9beda0a81745f5714b7b9b5f661a376937be/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f7768697a7369642f6172726179626173652e737667)](https://packagist.org/packages/whizsid/arraybase)[![Latest Stable Version](https://camo.githubusercontent.com/3682dcb68414f673f8e8a2781f8bd0ecbf55798a8d23eb012010305d5bd97500/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f762f7768697a7369642f6172726179626173652e737667)](https://packagist.org/packages/whizsid/arraybase)[![Build: parsing](https://camo.githubusercontent.com/c4c9c1a6e0189f185fda882e109137ea6af31722e830887deff57578ded13157/68747470733a2f2f7472617669732d63692e636f6d2f7768697a7369642f6172726179626173652e7376673f6272616e63683d6d6173746572)](https://travis-ci.com/whizsid/arraybase)[![Style CI: parsed](https://camo.githubusercontent.com/7e0b86b2565b86c429dc995ff904a344d5b0b1ba179a26a612094ee758b3e9d0/68747470733a2f2f6769746875622e7374796c6563692e696f2f7265706f732f3136313231393236362f736869656c64)](https://github.styleci.io/repos/161219266)

Runtime SQL like query lanaguage for manipulate php arrays. written in pure php and not using any sql engine. Note:- this is not an any kind of query builder.

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

[](#installation)

You can install arraybase on composer package manager by using below command.

```
composer require whizsid/arraybase

```

Basic
-----

[](#basic)

### Creating an ArrayBase instance

[](#creating-an-arraybase-instance)

This is how we are creating an array base instance.

```
use WhizSid\ArrayBase\AB;

$ab = new AB;

```

ArrayBase is simpler than other SQL Engines.

### Creating an ArrayBase Table

[](#creating-an-arraybase-table)

```
use WhizSid\ArrayBase\AB\Table;
use WhizSid\ArrayBase\AB\Table\Column;

$ab->createTable('customers',function(Table $tbl){
    $tbl->createColumn('cus_id',function(Column $clmn){
        $clmn->setType('integer')->setAutoIncrement();
    });
    $tbl->createColumn('cus_name',function(Column $clmn){
        $clmn->setType('varchar');
    });
    $tbl->createColumn('cus_phone',function(Column $clmn){
        $clmn->setType('varchar');
    })
});

```

Or with data array.

```
$ab->createTable('tbl_another',[
	[
		'c_id'=>1,
		'ant_id'=>"A"
	],
	[
		'c_id'=>2,
		'ant_id'=>"B"
	]
]);

```

### Join Clause

[](#join-clause)

```
use WhizSid\ArrayBase\AB\Query\Clause\Join;

$query = $ab->query();

$select = $query->select($ab->tbl_customer->as('cus'));

$select->join($ab->tbl_customer_cv->as('cv'))->on($query->cv->c_id,$query->cus->c_id);

$results = $select->execute();

```

Where Clause
------------

[](#where-clause)

```
$select->where($query->cus->c_id,"4567")->and($query->cv->c_name,"my name");

```

Limit
-----

[](#limit)

```
$select->limit(10,20);

```

Order
-----

[](#order)

```
$select->orderBy($query->cus->c_name)->orderBy($query->cus->c_address,"desc");

```

### Select query

[](#select-query)

```
$selectQuery = $ab->query()->select(
	$ab->tbl_customer,
	$ab::groupConcat(AB_DISTINCT,$ab->tbl_facility->fac_code)->as('new_sum'),
	$ab->tbl_customer->c_id,
	$ab->tbl_another->ant_id,
	$ab->tbl_facility->fac_code
);

$selectQuery->join(AB_JOIN_INNER,$ab->tbl_facility)->on($ab->tbl_customer->c_id,'=',$ab->tbl_facility->c_id);
$selectQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_customer->c_id,'=',$ab->tbl_another->c_id);
$selectQuery->orderBy($ab->tbl_customer->c_id,'desc');
$selectQuery->groupBy($ab->tbl_another->ant_id);
$selectQuery->where($ab->tbl_another->ant_id,'=',"A");
$selectQuery->limit(1);
$result = $selectQuery->execute()->fetchAssoc();

```

### Update Query

[](#update-query)

```
$updateQuery = $ab->query()->update($ab->tbl_customer)->set($ab->tbl_customer->c_name,'Updated name');
$updateQuery->where($ab->tbl_another->ant_id,"B");
$updateQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_another->c_id,'=',$ab->tbl_customer->c_id);
$updateQuery->limit(1);
$updateQuery->execute();

```

### Delete query

[](#delete-query)

```
$deleteQuery = $ab->query()->delete($ab->tbl_customer);
$deleteQuery->where($ab->tbl_another->ant_id,"B");
$deleteQuery->join(AB_JOIN_INNER,$ab->tbl_another)->on($ab->tbl_another->c_id,'=',$ab->tbl_customer->c_id);
$deleteQuery->limit(1);
$deleteQuery->execute();

```

All Examples in the `example/index.php` file.

Goals
-----

[](#goals)

To bring all MySQL functions to PHP.

[Read the full documentation](https://whizsid.github.io/arraybase)

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance19

Infrequent updates — may be unmaintained

Popularity18

Limited adoption so far

Community9

Small or concentrated contributor base

Maturity59

Maturing project, gaining track record

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

Total

3

Last Release

2491d ago

Major Versions

0.0.1 → 1.0.02019-06-06

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/44908250?v=4)[WhizSid](/maintainers/whizsid)[@whizsid](https://github.com/whizsid)

---

Top Contributors

[![whizsid](https://avatars.githubusercontent.com/u/44908250?v=4)](https://github.com/whizsid "whizsid (49 commits)")

---

Tags

arraygrouphelperjoinmanipulatememory-databasephppinnedsqlwherephparraysqlcollectionjoinselectupdategrouporderrightleftinnerouter

###  Code Quality

TestsPHPUnit

### Embed Badge

![Health badge](/badges/whizsid-arraybase/health.svg)

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

###  Alternatives

[aura/sqlquery

Object-oriented query builders for MySQL, Postgres, SQLite, and SQLServer; can be used with any database connection library.

4883.1M37](/packages/aura-sqlquery)[clouddueling/mysqldump-php

PHP version of mysqldump cli that comes with MySQL

1.3k23.2k](/packages/clouddueling-mysqldump-php)[atlas/query

Object-oriented query builders and performers for MySQL, Postgres, SQLite, and SQLServer.

41256.9k7](/packages/atlas-query)[bentools/where

PHP7.1 Fluent, immutable SQL query builder. Connectionless, framework-agnostic, no dependency.

125.2k2](/packages/bentools-where)[webparking/laravel-type-safe-collection

This package provides type-safe extension of the laravel collection, forcing a single type of object.

378.2k](/packages/webparking-laravel-type-safe-collection)

PHPackages © 2026

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